Manipulation Functions

Array API specification for manipulating arrays.

A conforming implementation of the array API standard must provide and support the following functions adhering to the following conventions.

  • Positional parameters must be positional-only parameters. Positional-only parameters have no externally-usable name. When a function accepting positional-only parameters is called, positional arguments are mapped to these parameters based solely on their order.

  • Optional parameters must be keyword-only arguments.

  • Unless stated otherwise, functions must adhere to the type promotion rules defined in Type Promotion Rules.

Objects in API

concat(arrays, /, *, axis=0)

Joins a sequence of arrays along an existing axis.

expand_dims(x, /, *, axis=0)

Expands the shape of an array by inserting a new axis (dimension) of size one at the position specified by axis.

flip(x, /, *, axis=None)

Reverses the order of elements in an array along the given axis.

permute_dims(x, /, axes)

Permutes the axes (dimensions) of an array x.

reshape(x, /, shape, *, copy=None)

Reshapes an array without changing its data.

roll(x, /, shift, *, axis=None)

Rolls array elements along a specified axis.

squeeze(x, /, axis)

Removes singleton dimensions (axes) from x.

stack(arrays, /, *, axis=0)

Joins a sequence of arrays along a new axis.