Skip to content

Commit f84ae58

Browse files
committed
Remove non-standard __dot__ and __rdot__
1 parent 51a4d92 commit f84ae58

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

pytensor/sparse/basic.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,12 @@ def __gt__(self, other):
375375
def __ge__(self, other):
376376
return ge(self, other)
377377

378-
def __dot__(left, right):
379-
return structured_dot(left, right)
380-
381-
def __rdot__(right, left):
382-
return structured_dot(left, right)
378+
def dot(self, other):
379+
return structured_dot(self, other)
383380

384381
def sum(self, axis=None, sparse_grad=False):
385382
return sp_sum(self, axis=axis, sparse_grad=sparse_grad)
386383

387-
dot = __dot__
388-
389384
def toarray(self):
390385
return dense_from_sparse(self)
391386

pytensor/tensor/variable.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,8 @@ def dtype(self):
640640
"""The dtype of this tensor."""
641641
return self.type.dtype
642642

643-
def __dot__(left, right):
644-
return at.math.dense_dot(left, right)
645-
646-
def __rdot__(right, left):
647-
return at.math.dense_dot(left, right)
648-
649-
dot = __dot__
643+
def dot(self, other):
644+
return at.math_dense_dot(self, other)
650645

651646
def __matmul__(left, right):
652647
return at.math.matmul(left, right)

tests/tensor/test_variable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_numpy_method(fct, value):
7575
utt.assert_allclose(np.nan_to_num(f(value)), np.nan_to_num(fct(value)))
7676

7777

78-
def test_infix_dot_method():
78+
def test_dot_method():
7979
X = dmatrix("X")
8080
y = dvector("y")
8181

0 commit comments

Comments
 (0)