Rate this Page
★ ★ ★ ★ ★

_choose_quant_func_and_quantize_tensor#

torchao.quantization.quantize_.common._choose_quant_func_and_quantize_tensor(tensor: Tensor, quant_kwargs: QuantizeTensorKwargs, scale: Tensor | None = None, zero_point: Tensor | None = None) → Tensor[source][source]#

Given a tensor and a kwargs container, chooses a derived dtype (float8, int8, etc) to quantize tensor to, based on the type of quant_kwargs quantizes tensor to the derived dtype chosen in (1) This is needed to support flexible quantization of activation to various derived dtypes.