set_backend¶
- aimet_torch.quantization.set_backend(name)[source]¶
Set global backend for quantization operations. Choices: [“triton”, “torch_builtins”]
- Return type:
_ContextManager
Example
>>> # Temporarily set backend to triton >>> with aimet_torch.quantization.set_backend("triton"): ... aimet_torch.quantization.affine.quantize( ... torch.arange(0, 1, step=0.1), torch.tensor(0.005), torch.tensor(0), 0, 255, ... ) ... tensor([ 0., 20., 40., 60., 80., 100., 120., 140., 160., 180.]) >>> # Permanently set backend to triton >>> aimet_torch.quantization.set_backend("triton") >>> aimet_torch.quantization.affine.quantize( ... torch.arange(0, 1, step=0.1), torch.tensor(0.005), torch.tensor(0), 0, 255, ... ) ... tensor([ 0., 20., 40., 60., 80., 100., 120., 140., 160., 180.])