QuantizedLinear

class aimet_torch.nn.QuantizedLinear(*args, **kwargs)[source]

Quantized subclass of torch.nn.Linear

forward(self, input: torch.Tensor) torch.Tensor[source]

Quantized forward of torch.nn.Linear.

The input(s), parameter(s) (if any), and output(s) will be quantized with self.input_quantizers, self.param_quantizers, and self.output_quantizers respectively.

For more information, see QuantizationMixin.

forward(*args, **kwargs)[source]

Computes a quantized version of the parent module’s forward method.

The forward() method should perform the following logic in order:

  1. Apply existing input quantizers to input tensors

  2. Apply existing param quantizers to the layer’s parameters

  3. Call the inherited torch.nn.Module forward method with quantized inputs and parameters

  4. Apply existing output quantizers to the outputs of the forward method

If all input, output, and parameter quantizers are None, this method will behave exactly the same as its parent module’s forward pass.