Contents

reinterpretCast(_:to:name:)

Creates a reinterpret cast operation and returns the result tensor.

Declaration

func reinterpretCast(_ tensor: MPSGraphTensor, to type: MPSDataType, name: String?) -> MPSGraphTensor

Parameters

  • tensor:

    The input tensor.

  • type:

    The element type of the returned tensor.

  • name:

    The name for the operation.

Return Value

A valid MPSGraphTensor object.

Discussion

Returns input tensor (with element type tensor_type) reinterpreted to element type passed in with the last dimension scaled by sizeof(tensor_type) / sizeof(type). This operation is endianness agnostic and MPSGraph reinterprets the data with the endianness of the system.