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]

另请参阅

参数:
  • ary (ArrayLike)

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

  • axis (int)

返回类型:

列表[Array]