jax.numpy.hsplit#

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

将数组水平分割成子数组。

numpy.hsplit() 的 JAX 实现。

有关详细信息,请参阅 jax.numpy.split() 的文档。hsplit 等效于 split,其中 axis=1,或者对于一维数组,axis=0

示例

一维数组

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

二维数组

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

另请参阅

参数:
  • ary (类数组)

  • indices_or_sections (int | 序列[int] | 类数组)

返回类型:

list[Array]