mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
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:
committed by
PyTorch MergeBot
parent
135af0fe30
commit
57c6bbd274
@ -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;
|
||||
|
Reference in New Issue
Block a user