mlx.core.view

Contents

mlx.core.view#

view(a: scalar | array, dtype: Dtype, stream: None | Stream | Device = None) array#

View the array as a different type.

The output shape changes along the last axis if the input array’s type and the input dtype do not have the same size.

Note: the view op does not imply that the input and output arrays share their underlying data. The view only gaurantees that the binary representation of each element (or group of elements) is the same.

Parameters:
  • a (array) – Input array or scalar.

  • dtype (Dtype) – The data type to change to.

Returns:

The array with the new type.

Return type:

array