Make TensorImpl::check_pyobj const (#81001)

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81001
Approved by: https://github.com/albanD
This commit is contained in:
Edward Z. Yang
2022-07-06 18:48:22 -04:00
committed by PyTorch MergeBot
parent 135af0fe30
commit 57c6bbd274
2 changed files with 3 additions and 3 deletions

View File

@ -2315,8 +2315,7 @@ c10::IntArrayRef concrete_strides_fn(
py::object values = py::reinterpret_steal<py::object>(out.ptr());
c10::TensorImpl* ptr = const_cast<c10::TensorImpl*>(self);
c10::optional<PyObject*> mb_obj = ptr->check_pyobj(getPyInterpreter());
c10::optional<PyObject*> mb_obj = self->check_pyobj(getPyInterpreter());
TORCH_CHECK(
mb_obj.has_value(), "Tensor subclass's PyInterpreter has no value");
PyObject* subclass = *mb_obj;