quantize — PyTorch 2.7 documentation (original) (raw)

class torch.ao.quantization.quantize(model, run_fn, run_args, mapping=None, inplace=False)[source][source]

Quantize the input float model with post training static quantization.

First it will prepare the model for calibration, then it callsrun_fn which will run the calibration step, after that we will convert the model to a quantized model.

Parameters

Returns

Quantized model.