Skip to content

Commit 39c1b49

Browse files
committed
Add default Op.__repr__
1 parent 5a39ef6 commit 39c1b49

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pytensor/graph/op.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,11 @@ def make_thunk(
621621
def __str__(self):
622622
return getattr(type(self), "__name__", super().__str__())
623623

624+
def __repr__(self):
625+
props = getattr(self, "__props__", ())
626+
props = ",".join(f"{prop}={getattr(self, prop, '?')}" for prop in props)
627+
return f"{self.__class__.__name__}({props})"
628+
624629

625630
class _NoPythonOp(Op):
626631
"""A class used to indicate that an `Op` does not provide a Python implementation.

0 commit comments

Comments
 (0)