Array Manipulation Routines

Basic manipulations

cupy.copyto Copies values from one array to another with broadcasting.

Shape manipulation

cupy.reshape Returns an array with new shape and same elements.
cupy.ravel Returns a flattened array.

Transposition

cupy.moveaxis Moves axes of an array to new positions.
cupy.rollaxis Moves the specified axis backwards to the given place.
cupy.swapaxes Swaps the two axes.
cupy.transpose Permutes the dimensions of an array.

Edit dimensionalities

cupy.atleast_1d Converts arrays to arrays with dimensions >= 1.
cupy.atleast_2d Converts arrays to arrays with dimensions >= 2.
cupy.atleast_3d Converts arrays to arrays with dimensions >= 3.
cupy.broadcast Object that performs broadcasting.
cupy.broadcast_arrays Broadcasts given arrays.
cupy.broadcast_to Broadcast an array to a given shape.
cupy.expand_dims Expands given arrays.
cupy.squeeze Removes size-one axes from the shape of an array.

Changing kind of array

cupy.asarray Converts an object to array.
cupy.asanyarray Converts an object to array.
cupy.asfortranarray Return an array laid out in Fortran order in memory.
cupy.ascontiguousarray Returns a C-contiguous array.

Joining arrays along axis

cupy.concatenate Joins arrays along an axis.
cupy.stack Stacks arrays along a new axis.
cupy.column_stack Stacks 1-D and 2-D arrays as columns into a 2-D array.
cupy.dstack Stacks arrays along the third axis.
cupy.hstack Stacks arrays horizontally.
cupy.vstack Stacks arrays vertically.

Splitting arrays along axis

cupy.split Splits an array into multiple sub arrays along a given axis.
cupy.array_split Splits an array into multiple sub arrays along a given axis.
cupy.dsplit Splits an array into multiple sub arrays along the third axis.
cupy.hsplit Splits an array into multiple sub arrays horizontally.
cupy.vsplit Splits an array into multiple sub arrays along the first axis.

Repeating part of arrays along axis

cupy.tile Construct an array by repeating A the number of times given by reps.
cupy.repeat Repeat arrays along an axis.

Rearranging elements

cupy.flip Reverse the order of elements in an array along the given axis.
cupy.fliplr Flip array in the left/right direction.
cupy.flipud Flip array in the up/down direction.
cupy.reshape Returns an array with new shape and same elements.
cupy.roll Roll array elements along a given axis.
cupy.rot90 Rotate an array by 90 degrees in the plane specified by axes.