Skip to content

Commit deeba35

Browse files
committed
Speedup variable owner access
1 parent 4c158f4 commit deeba35

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

pytensor/graph/basic.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -452,23 +452,7 @@ class Variable(Node, Generic[_TypeType, OptionalApplyType]):
452452
# __slots__ = ['type', 'owner', 'index', 'name']
453453
__count__ = count(0)
454454

455-
_owner: OptionalApplyType
456-
457-
@property
458-
def owner(self) -> OptionalApplyType:
459-
return self._owner
460-
461-
@owner.setter
462-
def owner(self, value) -> None:
463-
self._owner = value
464-
465-
@property
466-
def index(self):
467-
return self._index
468-
469-
@index.setter
470-
def index(self, value):
471-
self._index = value
455+
owner: OptionalApplyType
472456

473457
def __init__(
474458
self,
@@ -483,7 +467,7 @@ def __init__(
483467

484468
self.type = type
485469

486-
self._owner = owner
470+
self.owner = owner
487471

488472
if owner is not None and not isinstance(owner, Apply):
489473
raise TypeError("owner must be an Apply instance")

0 commit comments

Comments
 (0)