---
title: "quantize(_:scale:zeroPoint:dataType:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/quantize(_:scale:zeropoint:datatype:name:)"
---

# quantize(_:scale:zeroPoint:dataType:name:)

Creates a Quantize operation and returns the result tensor.

## Declaration

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

## Parameters

- `tensor`: Input tensor to be quantized
- `scale`: Scale scalar parameter
- `zeroPoint`: Bias scalar parameter (converted to dataType of resultTensor)
- `dataType`: Integer data type of the result tensor.
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor array of datatype dataType

## Discussion

Discussion Convert the float tensor to an i8 or u8 tensor by applying a scale + bias transform: result = (tensor / scale) + zeroPoint
