Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit 721e087

Browse files
committed
Document discrepancy with Clip and jax.numpy.clip
1 parent a0d00de commit 721e087

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

aesara/link/jax/dispatch/scalar.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ def identity(x):
5656

5757
@jax_funcify.register(Clip)
5858
def jax_funcify_Clip(op, **kwargs):
59+
"""Register the translation for the `Clip` `Op`.
60+
61+
Aesara's `Clip` operator operates differently from NumPy's when the
62+
specified `min` is larger than the `max` so we cannot reuse `jax.numpy.clip`
63+
to maintain consistency with Aesara.
64+
65+
"""
66+
5967
def clip(x, min, max):
6068
return jnp.where(x < min, min, jnp.where(x > max, max, x))
6169

0 commit comments

Comments
 (0)