jax.numpy.array_split#
- jax.numpy.array_split(ary, indices_or_sections, axis=0)[源码]#
将数组分割成子数组。
JAX 中对
numpy.array_split()
的实现。有关
jax.numpy.split()
的详细信息,请参阅其文档;array_split
等效于split
,但允许indices_or_sections
为整数,即使它不能将分割轴均匀划分。示例
>>> x = jnp.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> chunks = jnp.array_split(x, 4) >>> print(*chunks) [1 2 3] [4 5] [6 7] [8 9]
另请参阅
jax.numpy.split()
:沿任意轴拆分数组。jax.numpy.vsplit()
:垂直分割,即沿 axis=0jax.numpy.hsplit()
:水平分割,即沿 axis=1jax.numpy.dsplit()
:深度分割,即沿 axis=2