Skip to content

Commit 1f3a870

Browse files
committed
2 parents 374ccac + ed9f5bc commit 1f3a870

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

pytensor/tensor/math.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,11 +698,23 @@ def ge(a, b):
698698

699699

700700
def eq(a, b):
701-
"""Elementwise equality comparison, `a == b`."""
701+
"""Elementwise equality comparison, `a == b`.
702+
703+
Notes
704+
-----
705+
Due to Python rules, it is not possible to correctly overload the equality symbol `==` for hashable objects,
706+
so `eq` must always be used to compute the Elemwise equality of TensorVariables (which are hashable).
707+
"""
702708

703709

704710
def neq(a, b):
705-
"""Elementwise inequality comparison, `a != b`."""
711+
"""Elementwise inequality comparison, `a != b`.
712+
713+
Notes
714+
-----
715+
Due to Python rules, it is not possible to overload the non-equality symbol `!=` for hashable objects,
716+
so `neq` must always be used to compute the Elemwise non-equality of TensorVariables (which are hashable).
717+
"""
706718

707719

708720
def isnan(a):

0 commit comments

Comments
 (0)