Functional Update

Inside a function you plan to wrap in jax.jit, you need to zero out row 0 of a jnp.ndarray x. Which approach is both valid JAX and traceable under jit?

A

x[0].fill(0.0)

B

x = x.copy(); x[0, :] = 0.0

C

x[0, :] = 0.0

D

x.at[0, :].set(0.0)

E

np.put(x, [0], 0.0)