dpctl.tensor.stack(arrays, axis)[source]

Joins a sequence of arrays along a new axis.

  • arrays (Union[List[usm_ndarray], Tuple[usm_ndarray,...]]) – input arrays to join. Each array must have the same shape.

  • axis (int) – axis along which the arrays will be joined. Providing an axis specified the index of the new axis in the dimensions of the output array. A valid axis must be on the interval [-N, N), where N is the rank (number of dimensions) of x. Default: 0.


An output array having rank N+1, where N is the rank (number of dimensions) of x. If the input arrays have different data types, array API Type Promotion Rules apply.

Return type:


  • ValueError – if not all input arrays have the same shape

  • IndexError – if provided an axis outside of the required interval.