Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions python/tvm/te/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,6 @@ class PlaceholderOp(Operation):
class BaseComputeOp(Operation):
"""Compute operation."""
Comment on lines 131 to 132
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While removing the broken properties is correct, it would be beneficial for code readability and maintainability to add a docstring explaining that axis and reduce_axis are automatically exposed by the FFI, as you mentioned in the PR description. This helps future developers understand where these attributes come from without having to trace back to the C++ FFI registration.

How about updating the class docstring?

Suggested change
class BaseComputeOp(Operation):
"""Compute operation."""
class BaseComputeOp(Operation):
"""Compute operation.
The `axis` and `reduce_axis` attributes are automatically exposed by the FFI.
"""


@property
def axis(self):
"""Represent the IterVar axis, defined when it is a ComputeOp"""
return self.__getattr__("axis")

@property
def reduce_axis(self):
"""Represent axis of reductions, only defined when it is a ComputeOp"""
return self.__getattr__("reduce_axis")


@tvm_ffi.register_object("te.ComputeOp")
class ComputeOp(BaseComputeOp):
Expand All @@ -151,11 +141,6 @@ class ComputeOp(BaseComputeOp):
class ScanOp(Operation):
"""Scan operation."""
Comment on lines 141 to 142
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to BaseComputeOp, it would be helpful to add a docstring to ScanOp to clarify that the scan_axis attribute is exposed via the FFI. This improves discoverability and maintainability.

Suggested change
class ScanOp(Operation):
"""Scan operation."""
class ScanOp(Operation):
"""Scan operation.
The `scan_axis` attribute is automatically exposed by the FFI.
"""


@property
def scan_axis(self):
"""Represent the scan axis, only defined when it is a ScanOp"""
return self.__getattr__("scan_axis")


@tvm_ffi.register_object("te.ExternOp")
class ExternOp(Operation):
Expand Down
Loading