jax.numpy.vsplit

Contents

jax.numpy.vsplit#

jax.numpy.vsplit(ary, indices_or_sections)[source]#

Split an array into sub-arrays vertically.

JAX implementation of numpy.vsplit().

Refer to the documentation of jax.numpy.split() for details; vsplit is equivalent to split with axis=0.

Examples

1D array:

>>> x = jnp.array([1, 2, 3, 4, 5, 6])
>>> x1, x2 = jnp.vsplit(x, 2)
>>> print(x1, x2)
[1 2 3] [4 5 6]

2D array:

>>> x = jnp.array([[1, 2, 3, 4],
...                [5, 6, 7, 8]])
>>> x1, x2 = jnp.vsplit(x, 2)
>>> print(x1, x2)
[[1 2 3 4]] [[5 6 7 8]]

See also

Parameters:
  • ary (ArrayLike)

  • indices_or_sections (int | Sequence[int] | ArrayLike)

Return type:

list[Array]