cupy.atleast_3d#

cupy.atleast_3d(*arys)[source]#

Converts arrays to arrays with dimensions >= 3.

If an input array has dimensions less than three, then this function inserts new axes to make it have three dimensions. The place of the new axes are following:

  • If its shape is (), then the shape of output is (1, 1, 1).

  • If its shape is (N,), then the shape of output is (1, N, 1).

  • If its shape is (M, N), then the shape of output is (M, N, 1).

  • Otherwise, the output is the input array itself.

Parameters

arys (tuple of arrays) – Arrays to be converted. All arguments must be cupy.ndarray objects.

Returns

If there are only one input, then it returns its converted version. Otherwise, it returns a list of converted arrays.