MultiplyNoNanΒΆ

Computes product x*y, returns 0 if y is 0 (safe against NaNs in x).

Abstract Signature:

MultiplyNoNan(x: Tensor, y: Tensor)

PyTorch

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

JAX (Core)

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

NumPy

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

Keras

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

TensorFlow

API: tf.math.multiply_no_nan
Strategy: Direct Mapping

Apple MLX

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

Flax NNX

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

PaxML / Praxis

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