ReciprocalNoNanΒΆ

Safe reciprocal, returns 0 where input is 0.

Abstract Signature:

ReciprocalNoNan(x: Tensor)

PyTorch

API: β€”
Strategy: Macro 'torch.where({x} == 0, 0.0, 1.0 / {x})'

JAX (Core)

API: β€”
Strategy: Macro 'jnp.where({x} == 0, 0.0, 1.0 / {x})'

NumPy

API: β€”
Strategy: Macro 'np.where({x} == 0, 0.0, 1.0 / {x})'

Keras

API: β€”
Strategy: Macro 'keras.ops.where({x} == 0, 0.0, 1.0 / {x})'

TensorFlow

API: tf.math.reciprocal_no_nan
Strategy: Direct Mapping

Apple MLX

API: β€”
Strategy: Macro 'mx.where({x} == 0, 0.0, 1.0 / {x})'

Flax NNX

API: β€”
Strategy: Macro 'jnp.where({x} == 0, 0.0, 1.0 / {x})'

PaxML / Praxis

API: β€”
Strategy: Macro 'jnp.where({x} == 0, 0.0, 1.0 / {x})'