Skip to content

Commit

Permalink
Expose Tensor::index via Python API (#3705)
Browse files Browse the repository at this point in the history
To be used in #3703
  • Loading branch information
wujingyue authored Jan 14, 2025
1 parent c8817e0 commit 3d27e10
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion csrc/python_frontend/python_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,13 @@ void initNvFuserPythonBindings(PyObject* module) {
return ss.str();
});
tensor_class.def_property_readonly(
"ndim", [](Tensor& self) { return self.dims; });
"ndim",
[](Tensor& self) { return self.dims; },
"Returns the rank of the tensor.");
tensor_class.def_property_readonly(
"index",
[](Tensor& self) { return self.index; },
"Returns the index of the tensor as in FusionDefinition.sched.tensors().");
tensor_class.def("_get_fusion_definition", [](Tensor& self) {
return self.fusion_definition;
});
Expand Down

0 comments on commit 3d27e10

Please sign in to comment.