Contents

dequantize(_:scale:zeroPoint:dataType:name:)

Creates Dequantize operation and returns the result tensor.

Declaration

func dequantize(_ tensor: MPSGraphTensor, scale: Double, zeroPoint: Double, dataType: MPSDataType, name: String?) -> MPSGraphTensor

Parameters

  • tensor:

    Input tensor to be dequantized

  • scale:

    Scale scalar parameter

  • zeroPoint:

    Bias scalar parameter (converted to dataType of tensor)

  • dataType:

    Float data type of the result tensor.

  • name:

    The name for the operation.

Return Value

A valid MPSGraphTensor array of datatype dataType

Discussion

Convert the quantized tensor to a float tensor by applying a scale + bias transform: result = scale * (tensor - zeroPoint)

Supported input types: MPSDataTypeInt4, MPSDataTypeUInt4, MPSDataTypeInt8, MPSDataTypeUInt8, MPSDataTypeFloat8E4M3, MPSDataTypeFloat8E5M2. The scale type and dataType must match (MPSDataTypeFloat16, MPSDataTypeFloat32, or MPSDataTypeBFloat16).