aihwkit.simulator.presets.web module

RPU configurations presets used for the composer interface.

class aihwkit.simulator.presets.web.OldWebComposerInferenceRPUConfig(tile_class=<class 'aihwkit.simulator.tiles.inference.InferenceTile'>, runtime=<factory>, pre_post=<factory>, tile_array_class=<class 'aihwkit.simulator.tiles.array.TileModuleArray'>, mapping=<factory>, forward=<factory>, noise_model=<factory>, drift_compensation=<factory>, clip=<factory>, remap=<factory>, modifier=<factory>)[source]

Bases: WebComposerInferenceRPUConfig

Preset configuration used as default for the Inference Composer

Parameters:
mapping: MappingParameter

Parameter related to mapping weights to tiles for supporting modules.

class aihwkit.simulator.presets.web.OldWebComposerMappingParameter(digital_bias=False, weight_scaling_omega=1.0, weight_scaling_columnwise=True, weight_scaling_lr_compensation=False, learn_out_scaling=False, out_scaling_columnwise=False, max_input_size=0, max_output_size=0)[source]

Bases: WebComposerMappingParameter

Parameter related to hardware design and the mapping of logical weight matrices to physical tiles.

The default values used for the web composer.

Parameters:
  • digital_bias (bool) –

  • weight_scaling_omega (float) –

  • weight_scaling_columnwise (bool) –

  • weight_scaling_lr_compensation (bool) –

  • learn_out_scaling (bool) –

  • out_scaling_columnwise (bool) –

  • max_input_size (int) –

  • max_output_size (int) –

digital_bias: bool = False

Whether the bias term is handled by the analog tile or kept in digital.

Note

Default is having a digital bias so that bias values are not stored onto the analog crossbar. This needs to be supported by the chip design. Set to False if the analog bias is instead situated on the the crossbar itself (as an extra column)

Note

digital_bias is supported by all analog modules.

learn_out_scaling: bool = False

Define (additional) out scales that are learnable parameter used to scale the output.

max_input_size: int = 0

Maximal input size (number of columns) of the weight matrix that is handled on a single analog tile.

If the logical weight matrix size exceeds this size it will be split and mapped onto multiple analog tiles.

Caution

Only relevant for Mapped modules such as aihwkit.nn.modules.linear_mapped.AnalogLinearMapped.

max_output_size: int = 0

Maximal output size (number of rows) of the weight matrix that is handled on a single analog tile.

If the logical weight matrix size exceeds this size it will be split and mapped onto multiple analog tiles.

Caution

Only relevant for Mapped modules such as aihwkit.nn.modules.linear_mapped.AnalogLinearMapped.

out_scaling_columnwise: bool = False

Whether the learnable out scaling parameter enabled by learn_out_scaling is a scalar (False) or learned for each output (True).

weight_scaling_columnwise: bool = True

Whether the weight matrix will be remapped column-wise over the maximum device allowed value.

weight_scaling_omega: float = 1.0

omega_scale is a user defined parameter used to scale the weights while remapping these to cover the full range of values allowed. By default, no remapping is performed. If values > 0.0 are supplied the abs-max of the weight is scaled to that value.

class aihwkit.simulator.presets.web.WebComposerIOParameters(is_perfect=False, mv_type=AnalogMVType.ONE_PASS, inp_bound=1.0, inp_noise=0.0, inp_res=0.007936507936507936, inp_sto_round=False, inp_asymmetry=0.0, out_bound=20.0, out_noise=0.1, out_noise_std=0.0, out_res=0.00196078431372549, out_sto_round=False, out_scale=1.0, out_asymmetry=0.0, bound_management=BoundManagementType.ITERATIVE, noise_management=NoiseManagementType.ABS_MAX, w_noise=0.0, w_noise_type=WeightNoiseType.NONE, ir_drop=0.0, ir_drop_g_ratio=571428.5714285714, out_nonlinearity=0.0, out_nonlinearity_std=0.0, slope_calibration=0.0, v_offset_std=0.0, v_offset_w_min=-1.0, r_series=0.0, w_read_asymmetry_dtod=0.0, max_bm_factor=1000, max_bm_res=0.25, bm_test_negative_bound=True, nm_thres=0.0)[source]

Bases: IOParameters

Preset for the forward and backward pass parameters.

The default values used for the web composer

Parameters:
  • is_perfect (bool) –

  • mv_type (AnalogMVType) –

  • inp_bound (float) –

  • inp_noise (float) –

  • inp_res (float) –

  • inp_sto_round (bool) –

  • inp_asymmetry (float) –

  • out_bound (float) –

  • out_noise (float) –

  • out_noise_std (float) –

  • out_res (float) –

  • out_sto_round (bool) –

  • out_scale (float) –

  • out_asymmetry (float) –

  • bound_management (BoundManagementType) –

  • noise_management (NoiseManagementType) –

  • w_noise (float) –

  • w_noise_type (WeightNoiseType) –

  • ir_drop (float) –

  • ir_drop_g_ratio (float) –

  • out_nonlinearity (float) –

  • out_nonlinearity_std (float) –

  • slope_calibration (float) –

  • v_offset_std (float) –

  • v_offset_w_min (float) –

  • r_series (float) –

  • w_read_asymmetry_dtod (float) –

  • max_bm_factor (int) –

  • max_bm_res (float) –

  • bm_test_negative_bound (bool) –

  • nm_thres (float) –

bound_management: BoundManagementType = 'Iterative'

Type of bound management, see BoundManagementType.

Caution

Bound management is only available for the forward pass. It will be ignored when used for the backward pass.

inp_res: float = 0.007936507936507936

Number of discretization steps for DAC (\(\le0\) means infinite steps) or resolution (1/steps).

inp_sto_round: bool = False

Whether to enable stochastic rounding of DAC.

noise_management: NoiseManagementType = 'AbsMax'

Type of noise management, see NoiseManagementType.

out_bound: float = 20.0

Output bound and ranges for analog-to-digital converter (ADC).

out_noise: float = 0.1

Output noise strength at each output of a tile.

This sets the std-deviation of the Gaussian output noise (\(\sigma_\text{out}\)) at each output, i.e. noisiness of device summation at the output.

out_res: float = 0.00196078431372549

Number of discretization steps for ADC or resolution.

Number of discretization steps for ADC (\(<=0\) means infinite steps) or resolution (1/steps).

w_noise: float = 0.0

Scale of output referred weight noise (\(\sigma_w\)) for a given w_noise_type.

w_noise_type: WeightNoiseType = 'None'

Type as specified in OutputWeightNoiseType.

Note

This noise us applied each time anew as it is referred to the output. It will not change the conductance values of the weight matrix. For the latter one can apply diffuse_weights().

class aihwkit.simulator.presets.web.WebComposerInferenceRPUConfig(tile_class=<class 'aihwkit.simulator.tiles.inference.InferenceTile'>, runtime=<factory>, pre_post=<factory>, tile_array_class=<class 'aihwkit.simulator.tiles.array.TileModuleArray'>, mapping=<factory>, forward=<factory>, noise_model=<factory>, drift_compensation=<factory>, clip=<factory>, remap=<factory>, modifier=<factory>)[source]

Bases: InferenceRPUConfig

Preset configuration used as default for the Inference Composer

Parameters:
clip: WeightClipParameter

Parameter for weight clip.

drift_compensation: BaseDriftCompensation

For compensating the drift during inference only.

forward: IOParameters

Input-output parameter setting for the forward direction.

mapping: MappingParameter

Parameter related to mapping weights to tiles for supporting modules.

modifier: WeightModifierParameter

Parameter for weight modifier.

noise_model: BaseNoiseModel

Statistical noise model to be used during (realistic) inference.

class aihwkit.simulator.presets.web.WebComposerMappingParameter(digital_bias=True, weight_scaling_omega=1.0, weight_scaling_columnwise=True, weight_scaling_lr_compensation=False, learn_out_scaling=True, out_scaling_columnwise=False, max_input_size=512, max_output_size=512)[source]

Bases: MappingParameter

Parameter related to hardware design and the mapping of logical weight matrices to physical tiles.

The default values used for the web composer.

Parameters:
  • digital_bias (bool) –

  • weight_scaling_omega (float) –

  • weight_scaling_columnwise (bool) –

  • weight_scaling_lr_compensation (bool) –

  • learn_out_scaling (bool) –

  • out_scaling_columnwise (bool) –

  • max_input_size (int) –

  • max_output_size (int) –

digital_bias: bool = True

Whether the bias term is handled by the analog tile or kept in digital.

Note

Default is having a digital bias so that bias values are not stored onto the analog crossbar. This needs to be supported by the chip design. Set to False if the analog bias is instead situated on the the crossbar itself (as an extra column)

Note

digital_bias is supported by all analog modules.

learn_out_scaling: bool = True

Define (additional) out scales that are learnable parameter used to scale the output.

max_input_size: int = 512

Maximal input size (number of columns) of the weight matrix that is handled on a single analog tile.

If the logical weight matrix size exceeds this size it will be split and mapped onto multiple analog tiles.

Caution

Only relevant for Mapped modules such as aihwkit.nn.modules.linear_mapped.AnalogLinearMapped.

max_output_size: int = 512

Maximal output size (number of rows) of the weight matrix that is handled on a single analog tile.

If the logical weight matrix size exceeds this size it will be split and mapped onto multiple analog tiles.

Caution

Only relevant for Mapped modules such as aihwkit.nn.modules.linear_mapped.AnalogLinearMapped.

out_scaling_columnwise: bool = False

Whether the learnable out scaling parameter enabled by learn_out_scaling is a scalar (False) or learned for each output (True).

weight_scaling_columnwise: bool = True

Whether the weight matrix will be remapped column-wise over the maximum device allowed value.

weight_scaling_omega: float = 1.0

omega_scale is a user defined parameter used to scale the weights while remapping these to cover the full range of values allowed. By default, no remapping is performed. If values > 0.0 are supplied the abs-max of the weight is scaled to that value.

class aihwkit.simulator.presets.web.WebComposerWeightClipParameter(fixed_value=1.0, sigma=2.5, type=WeightClipType.FIXED_VALUE)[source]

Bases: WeightClipParameter

Parameter that clip the weights during hardware-aware training.

The default values used for the web composer.

Parameters:
fixed_value: float = 1.0

Clipping value in case of FixedValue type.

Caution

If fixed_value > 0 it will be also applied during other clipping types.

type: WeightClipType = 'FixedValue'

Type of clipping.

class aihwkit.simulator.presets.web.WebComposerWeightModifierParameter(std_dev=0.1, per_batch_sample=False, res=0.0, sto_round=False, dorefa_clip=0.6, pdrop=0.0, enable_during_test=False, rel_to_actual_wmax=True, assumed_wmax=1.0, copy_last_column=False, coeffs=<factory>, type=WeightModifierType.ADD_NORMAL, g_max=25.0, pcm_zero_thres=0.0, pcm_t_inference=0.0, pcm_prob_at_reset=0.0, pcm_prob_at_gmax=0.0, pcm_prob_at_random=0.0, pcm_t0=20.0)[source]

Bases: WeightModifierParameter

Preset for the WeightModifierParameter

The default values used for the web composer

Parameters:
  • std_dev (float) –

  • per_batch_sample (bool) –

  • res (float) –

  • sto_round (bool) –

  • dorefa_clip (float) –

  • pdrop (float) –

  • enable_during_test (bool) –

  • rel_to_actual_wmax (bool) –

  • assumed_wmax (float) –

  • copy_last_column (bool) –

  • coeffs (List[float]) –

  • type (WeightModifierType) –

  • g_max (float) –

  • pcm_zero_thres (float) –

  • pcm_t_inference (float) –

  • pcm_prob_at_reset (float) –

  • pcm_prob_at_gmax (float) –

  • pcm_prob_at_random (float) –

  • pcm_t0 (float) –

std_dev: float = 0.1

Standard deviation of the added noise to the weight matrix.

This parameter affects the modifier types AddNormal, MultNormal and DiscretizeAddNormal.

Note

If the parameter rel_to_actual_wmax is set then the std_dev is computed in relative terms to the abs max of the given weight matrix, otherwise it in relative terms to the assumed max, which is set by assumed_wmax.

type: WeightModifierType = 'AddNormal'

Type of the weight modification.