Skip to content

Commit 5ec8e59

Browse files
committed
Speedup variable owner access
1 parent 6ebfebb commit 5ec8e59

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
@@ -451,23 +451,7 @@ class Variable(Node, Generic[_TypeType, OptionalApplyType]):
451451
# __slots__ = ['type', 'owner', 'index', 'name']
452452
__count__ = count(0)
453453

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

472456
def __init__(
473457
self,
@@ -482,7 +466,7 @@ def __init__(
482466

483467
self.type = type
484468

485-
self._owner = owner
469+
self.owner = owner
486470

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

0 commit comments

Comments
 (0)