I'm trying to understand the behaviour of JAX vmap, so I wrote the following code:
import jax.numpy as jnp
from jax import vmap
def what(a,b,c):
z = jnp.dot(a,b)
return z + c
v_what = vmap(what, in_axes=(None,0,None))
a = jnp.array([1,1,3])
b = jnp.array([2,2])
c = 1.0
v_what(a,b,c)
And the output is:
DeviceArray([[3., 3., 7.],
[3., 3., 7.]], dtype=float32)
I understand that the only input that is being altered is b, but Can someone shed some light on why this is the result? And how the dot product behaves after I vectorized the function?