This repository was archived by the owner on Nov 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 88
99#include < ATen/Tensor.h>
1010#include < c10/core/TensorImpl.h>
11+ #include < torch/csrc/PyInterpreter.h>
1112#include < torch/csrc/autograd/python_variable.h>
1213#include < torch/csrc/utils/pybind.h>
1314#include < torchdistx/deferred_init.h>
@@ -40,7 +41,7 @@ py::object makeVariable(PyTypeObject* type, Tensor data) {
4041 constexpr auto s = PyInterpreterStatus::DEFINITELY_UNINITIALIZED;
4142
4243 // Associate ATen and Python tensor instances.
43- data.unsafeGetTensorImpl ()->init_pyobj (getPyInterpreter (), naked_obj, s);
44+ data.unsafeGetTensorImpl ()->pyobj_slot ()-> init_pyobj (getPyInterpreter (), naked_obj, s);
4445
4546 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
4647 auto * var = reinterpret_cast <THPVariable*>(naked_obj);
@@ -83,7 +84,7 @@ py::object materializeVariable(const py::object& var) {
8384 // We might have already materialized `data`. Make sure that we preserve its
8485 // identity on the Python side and avoid creating a new Python tensor.
8586 c10::optional<PyObject*> opt_materialized_var =
86- materialized_data.unsafeGetTensorImpl ()->check_pyobj (getPyInterpreter ());
87+ materialized_data.unsafeGetTensorImpl ()->pyobj_slot ()-> check_pyobj (getPyInterpreter ());
8788 if (opt_materialized_var.has_value ()) {
8889 return py::reinterpret_borrow<py::object>(*opt_materialized_var);
8990 }
You can’t perform that action at this time.
0 commit comments