Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.hstack

Contents

jax.numpy.hstack#

jax.numpy.hstack(tup,dtype=None)[source]#

Horizontally stack arrays.

JAX implementation ofnumpy.hstack().

For arrays of one or more dimensions, this is equivalent tojax.numpy.concatenate() withaxis=1.

Parameters:
  • tup (np.ndarray |Array |Sequence[ArrayLike]) – a sequence of arrays to stack; each must have the same shape along allbut the second axis. Input arrays will be promoted to at least rank 1.If a single array is given it will be treated equivalently totup = unstack(tup), but the implementation will avoid explicit unstacking.

  • dtype (DTypeLike |None) – optional dtype of the resulting array. If not specified, the dtypewill be determined via type promotion rules described inType promotion semantics.

Returns:

the stacked result.

Return type:

Array

See also

Examples

Scalar values:

>>>jnp.hstack([1,2,3])Array([1, 2, 3], dtype=int32, weak_type=True)

1D arrays:

>>>x=jnp.arange(3)>>>y=jnp.ones(3)>>>jnp.hstack([x,y])Array([0., 1., 2., 1., 1., 1.], dtype=float32)

2D arrays:

>>>x=x.reshape(3,1)>>>y=y.reshape(3,1)>>>jnp.hstack([x,y])Array([[0., 1.],       [1., 1.],       [2., 1.]], dtype=float32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp