A sharding the array's shape cannot satisfy
A PartitionSpec is a promise that each named mesh axis divides its array dimension. Ten rows over four data shards leaves a remainder, and the runtime refuses rather than silently pad. Pad or reshape to a multiple, or shard a different dimension.
import jax
import jax.numpy as jnp
import numpy as np
from jax.sharding import Mesh, NamedSharding, PartitionSpec as P
mesh = Mesh(np.array(jax.devices()[:8]).reshape(4, 2), ("data", "model"))
x = jax.device_put(jnp.ones((10, 16)), NamedSharding(mesh, P("data", "model")))import jax
import jax.numpy as jnp
import numpy as np
from jax.sharding import Mesh, NamedSharding, PartitionSpec as P
mesh = Mesh(np.array(jax.devices()[:8]).reshape(4, 2), ("data", "model"))
x = jax.device_put(jnp.ones((12, 16)), NamedSharding(mesh, P("data", "model")))