PyTorch
API: —
Strategy: Macro 'torch.where({x} >= {threshold}, 1.0, 0.0)'
JAX (Core)
API: —
Strategy: Macro 'jnp.where({x} >= {threshold}, 1.0, 0.0)'
NumPy
API: —
Strategy: Macro '({x} >= {threshold}).astype(float)'
Keras
API: —
Strategy: Macro 'keras.ops.cast({x} >= {threshold}, dtype='float32')'
TensorFlow
API: —
Strategy: Macro 'tf.cast({x} >= {threshold}, dtype=tf.float32)'
Apple MLX
API: mlx.nn.step
Strategy: Direct Mapping
Flax NNX
API: —
Strategy: Macro 'jnp.where({x} >= {threshold}, 1.0, 0.0)'
PaxML / Praxis
API: —
Strategy: Macro 'jnp.where({x} >= {threshold}, 1.0, 0.0)'