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 8
8
9
9
#include < ATen/Tensor.h>
10
10
#include < c10/core/TensorImpl.h>
11
+ #include < torch/csrc/PyInterpreter.h>
11
12
#include < torch/csrc/autograd/python_variable.h>
12
13
#include < torch/csrc/utils/pybind.h>
13
14
#include < torchdistx/deferred_init.h>
@@ -40,7 +41,7 @@ py::object makeVariable(PyTypeObject* type, Tensor data) {
40
41
constexpr auto s = PyInterpreterStatus::DEFINITELY_UNINITIALIZED;
41
42
42
43
// 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);
44
45
45
46
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
46
47
auto * var = reinterpret_cast <THPVariable*>(naked_obj);
@@ -83,7 +84,7 @@ py::object materializeVariable(const py::object& var) {
83
84
// We might have already materialized `data`. Make sure that we preserve its
84
85
// identity on the Python side and avoid creating a new Python tensor.
85
86
c10::optional<PyObject*> opt_materialized_var =
86
- materialized_data.unsafeGetTensorImpl ()->check_pyobj (getPyInterpreter ());
87
+ materialized_data.unsafeGetTensorImpl ()->pyobj_slot ()-> check_pyobj (getPyInterpreter ());
87
88
if (opt_materialized_var.has_value ()) {
88
89
return py::reinterpret_borrow<py::object>(*opt_materialized_var);
89
90
}
You can’t perform that action at this time.
0 commit comments