Skip to content

Commit f6be521

Browse files
ricardoV94lucianopaz
authored andcommitted
Rename add inc_subtensor helper method to inc
1 parent 230a808 commit f6be521

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pytensor/tensor/variable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ def set(self, idx, y, **kwargs):
835835
"""
836836
return at.subtensor.set_subtensor(self[idx], y, **kwargs)
837837

838-
def add(self, idx, y, **kwargs):
838+
def inc(self, idx, y, **kwargs):
839839
"""Return a copy of self with the indexed values incremented by y.
840840
841841
Equivalent to inc_subtensor(self[idx], y). See docstrings for kwargs.
@@ -846,7 +846,7 @@ def add(self, idx, y, **kwargs):
846846
>>> import pytensor.tensor as pt
847847
>>>
848848
>>> x = pt.ones((3,))
849-
>>> out = x.add(1, 2)
849+
>>> out = x.inc(1, 2)
850850
>>> out.eval() # array([1., 3., 1.])
851851
"""
852852
return at.inc_subtensor(self[idx], y, **kwargs)

tests/tensor/test_variable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,13 @@ def test_take(self):
433433
# Test equivalent advanced indexing
434434
assert_array_equal(X[:, indices].eval({X: x}), x[:, indices])
435435

436-
def test_set_add(self):
436+
def test_set_inc(self):
437437
x = matrix("x")
438438
idx = [0]
439439
y = 5
440440

441441
assert equal_computations([x.set(idx, y)], [set_subtensor(x[idx], y)])
442-
assert equal_computations([x.add(idx, y)], [inc_subtensor(x[idx], y)])
442+
assert equal_computations([x.inc(idx, y)], [inc_subtensor(x[idx], y)])
443443

444444
def test_set_item_error(self):
445445
x = matrix("x")

0 commit comments

Comments
 (0)