dpctl.tensor.squeeze

dpctl.tensor.squeeze(x, axis)[source]

Removes singleton dimensions (axes) from array x.

Parameters:
  • x (usm_ndarray) – input array

  • axis (Union[int, Tuple[int,...]]) – axis (or axes) to squeeze.

Returns:

Output array is a view, if possible, and a copy otherwise, but with all or a subset of the dimensions of length 1 removed. Output has the same data type as the input, is allocated on the same device as the input and has the same USM allocation type as the input array x.

Return type:

usm_ndarray

Raises:

ValueError – if the specified axis has a size greater than one.