cupynumeric.expand_dims#

cupynumeric.expand_dims(
a: ndarray,
axis: int | tuple[int, ...] | list[int],
) ndarray#

Expand the shape of an array.

Insert a new axis that will appear at the axis position in the expanded array shape.

Parameters:
  • a (array_like) – Input array.

  • axis (int or tuple of ints) – Position in the expanded axes where the new axis (or axes) is placed.

Returns:

result – View of a with the number of dimensions increased.

Return type:

ndarray

See also

squeeze

The inverse operation, removing singleton dimensions

reshape

Insert, remove, and combine dimensions, and resize existing ones

atleast_1d, atleast_2d, atleast_3d

Availability:

Multiple GPUs, Multiple CPUs