<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShadersGraph",
  "identifier" : "/documentation/MetalPerformanceShadersGraph/MPSGraph/dequantize(_:scaleTensor:zeroPointTensor:dataType:name:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal Performance Shaders Graph",
      "MetalPerformanceShadersGraph"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSGraph(im)dequantizeTensor:scaleTensor:zeroPointTensor:dataType:name:"
  },
  "title" : "dequantize(_:scaleTensor:zeroPointTensor:dataType:name:)"
}
-->

# dequantize(_:scaleTensor:zeroPointTensor:dataType:name:)

Creates a dequantize operation and returns the result tensor.

```
func dequantize(_ tensor: MPSGraphTensor, scaleTensor: MPSGraphTensor, zeroPointTensor: MPSGraphTensor, dataType: MPSDataType, name: String?) -> MPSGraphTensor
```

## Parameters

`tensor`

Input tensor to be dequantized.

`scaleTensor`

The scale tensor with groups support.

`zeroPointTensor`

The bias tensor with groups support.

`dataType`

Float data type of the result tensor.

`name`

The name for the operation.

## Return Value

A valid [`MPSGraphTensor`](/documentation/MetalPerformanceShadersGraph/MPSGraphTensor) array of datatype `dataType`.

## Discussion

Convert the quantized `tensor` to a float tensor by applying a scale and bias transform:

```md
result = scaleTensor * (tensor - zeroPointTensor)
```

The quantization mode is determined by the element type of `scaleTensor`:

**Regular blockwise** (`scaleTensor` type is an MPSGraph float type):

- Supported input types: `MPSDataTypeInt4`, `MPSDataTypeUInt4`,
  `MPSDataTypeInt8`, `MPSDataTypeUInt8`,
  `MPSDataTypeFloat8E4M3`, `MPSDataTypeFloat8E5M2`.
- `zeroPointTensor` type must match the input `tensor` type.
- `scaleTensor` shape: leading dims of `tensor` with the last dim replaced by
  `tensor.shape[last] / blockSize`.

**MX mode** (`scaleTensor` type is `MPSDataTypeFloat8E8M0`):

- Supported input types: `MPSDataTypeFloat4E2M1`, `MPSDataTypeFloat8E4M3`, `MPSDataTypeFloat8E5M2`.
- Block size 32, symmetric (zero point must be 0).

**F4 with F8E4M3 scale** (`scaleTensor` type is `MPSDataTypeFloat8E4M3`,
input type is `MPSDataTypeFloat4E2M1`):

- Block size 16, symmetric (zero point must be 0).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)