aihwkit.simulator.tiles.quantized_inference_torch module
Tile with quantized periphery and outputs.
- class aihwkit.simulator.tiles.quantized_inference_torch.QuantizedTorchInferenceTile(out_size, in_size, rpu_config=None, bias=False, in_trans=False, out_trans=False)[source]
Bases:
TorchInferenceTileInferenceTile using a torch-based simulator tile (and not a tile from RPUCuda). It extends the TorchInferenceTile, adding support for quantized periphery, which corresponds to the bias and the affine scales, as well as output activation quantization with configurable parameters. To configure the various quantization parameters, use QuantizedTorchInferenceRPUConfig.
- Parameters:
out_size (int)
in_size (int)
rpu_config (QuantizedTorchInferenceRPUConfig | None)
bias (bool)
in_trans (bool)
out_trans (bool)
- forward(x_input, tensor_view=None)[source]
Torch forward function that calls the analog forward. It is different than the TorchInferenceTile in the way it handles the bias addition, affine scaling application and the output quantization. See the methods post_forward, apply_quant_periphery_scales and add_quant_periphery_bias in TileWithPeriphery for details
- Parameters:
x_input (Tensor)
tensor_view (Tuple | None)
- Return type:
Tensor