jax.numpy.vstack — JAX documentation (original) (raw)

jax.numpy.vstack#

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

Vertically stack arrays.

JAX implementation of numpy.vstack().

For arrays of two or more dimensions, this is equivalent tojax.numpy.concatenate() with axis=0.

Parameters:

Returns:

the stacked result.

Return type:

Array

See also

Examples

Scalar values:

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

1D arrays:

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

2D arrays:

x = x.reshape(1, 4) y = y.reshape(1, 4) jnp.vstack([x, y]) Array([[0., 1., 2., 3.], [1., 1., 1., 1.]], dtype=float32)