aihwkit.simulator.tiles.array module
Implements analog tile module array .
- class aihwkit.simulator.tiles.array.QuantizedTileModuleArray(out_size, in_size, rpu_config, bias=False, **kwargs)[source]
Bases:
TileModuleArrayLogical array of quantized torch inference tile modules. It extends the functionality of TileModuleArray, by adding quantization capability for the bias (which is applied here instead of the individual tiles) and for the final result of the array, after all the partial results from the tiles have been accumulated.
It only overwrites the forward function of the TileModuleArray, to add the output and bias quantization.
- Parameters:
out_size (int)
in_size (int)
rpu_config (QuantizedTorchInferenceRPUConfig)
bias (bool)
kwargs (Any)
- class aihwkit.simulator.tiles.array.TileModuleArray(out_size, in_size, rpu_config, bias=False, **kwargs)[source]
Bases:
Module,TileModuleBaseLogical array of tile modules.
Note
The bias in the RPUConfig does not have any effect since the bias is always concatenated for the logical array and added at the end in digital
- Parameters:
out_size (int)
in_size (int)
rpu_config (MappableRPU)
bias (bool)
kwargs (Any)
- forward(x_input, tensor_view=None)[source]
Compute the forward pass.
- Parameters:
x_input (Tensor)
tensor_view (Tuple | None)
- Return type:
Tensor
- get_split_sizes(size, split_max_size)[source]
Computed the split sizes.
- Parameters:
size (int) – number of elements of the layer in one dimension
split_max_size (int) – max size of the split
- Returns:
List of split sizes
- Return type:
List[int]
- get_weights(**kwargs)[source]
Get the (combined) weight (and bias) tensors from the analog crossbar(s).
- Parameters:
kwargs (Any) – see tile level, e.g.
get_weights()- Returns:
weight matrix, bias vector
- Return type:
tuple
- set_weights(weight, bias=None, **kwargs)[source]
Set the weight (and bias) values with given tensors to the analog crossbar(s).
- supports_indexed = False