MRFI function table¶
experiment¶
Name | Description | Args |
---|---|---|
logspace_density |
Similar as np.logspace but the datapoint always contains 10^{-n} | low ,high ,density ,return |
Acc_experiment |
Return classification accuracy on dataset. | model ,dataloader ,return |
observeFI_experiment |
Run fault inject experiment and return internal oberver results. | fi_model ,input_data ,use_golden ,observers_dict ,return |
BER_Acc_experiment |
Conduct a series of experimet under different bit error rate and get accuracy. | fi_model ,fi_selectors ,dataloader ,BER_range ,bit_width ,return |
BER_observe_experiment |
Conduct a series of experimet under different bit error rate and get all observers result. | fi_model ,fi_selectors ,dataloader ,BER_range ,bit_width ,use_golden ,return |
Acc_golden |
Evaluate model accuracy without error injection. | fi_model ,dataloader ,disable_quantization ,return |
observeFI_experiment_plus |
Run fault injection experiment and observe its internal effect. | fi_model ,input_data ,method ,pre_hook ,kwargs ,return |
get_activation_info |
Observe model activations without fault injection. | fi_model ,input_data ,method ,pre_hook ,kwargs ,return |
get_weight_info |
Observe model weights. | model ,method ,weight_name ,kwargs ,return |
observer¶
Name | Description | Args |
---|---|---|
BaseObserver |
Basement of observers. | |
MinMax |
Observe min/max range of tensors. | |
RMSE |
Root Mean Square Error metric between golden run and fault inject run. | |
SaveLast |
Simply save last inference internal tensor. | |
MaxAbs |
Observe max abs range of tensors. | |
MeanAbs |
Mean of abs, a metric of scale of values | |
Std |
Standard deviation of zero-mean values. | |
Shape |
Simply record tensor shape of last inference | |
MAE |
Mean Absolute Error between golden run and fault inject run. | |
EqualRate |
Compare how many value unchanged between golden run and fault inject run. | |
UniformSampling |
Uniform sampling from tensors between all inference, up to 10000 samples. |
selector¶
Name | Description | Args |
---|---|---|
EmptySelector |
No position selected by this, for debug or special use. | |
FixPosition |
Select fixed one position by coordinate. | position |
FixPositions |
Select a list of fixed positions by coordinate. | positions |
RandomPositionByNumber |
Select n random positions. | n ,per_instance |
RandomPositionByRate |
Select random positions by rate. | rate ,poisson |
RandomPositionByRate_classic |
Select random positions by rate. | rate |
MaskedDimRandomPositionByNumber |
Select n positions after specifed dimensions are masked. | n ,kwargs |
SelectedDimRandomPositionByNumber |
Select n positions on selected coordinate. | n ,kwargs |
MaskedDimRandomPositionByRate |
Select by rate where some coordinate are masked. | rate ,poisson ,kwargs |
SelectedDimRandomPositionByRate |
Select on some coordinate by rate. | rate ,poisson ,kwargs |
FixedPixelByNumber |
Select random channel on one fixed pixel (i.e. H * W dimension). | n ,pixel ,per_instance |
error_mode¶
Name | Description | Args |
---|---|---|
IntSignBitFlip |
Flip integer tensor on sign bit | x_in ,bit_width |
IntRandomBitFlip |
Flip integer tensor on random bit | x_in ,bit_width |
IntFixedBitFlip |
Flip integer tensor on specified bit | x_in ,bit_width ,bit |
SetZero |
Fault inject selected value to zero | x |
SetValue |
Fault inject value to specified value(s) | x ,value |
FloatRandomBitFlip |
Flip bit randomly on float values | x_in ,floattype |
FloatFixedBitFlip |
Flip specific bit on float values | x_in ,bit ,floattype |
IntRandom |
Uniformly set to random integer in range. | low ,high |
IntRandomBit |
Set fault value to a random bit_width -bit integer. |
bit_width ,signed |
UniformRandom |
Uniform set to float number in range. | low ,high |
NormalRandom |
Set fault injection value to a normal distribution. | mean ,std |
UniformDisturb |
Add uniform distribution noise to current value. | low ,high |
NormalDisturb |
Add normal distribution noise to current value. | std ,bias |
quantization¶
Name | Description | Args |
---|---|---|
SymmericQuantization |
Simple symmeric quantization. | dynamic_range ,scale_factor |
PositiveQuantization |
Simple positive quantization. | dynamic_range ,scale_factor |
FixPointQuantization |
Fixpoint quantization. | decimal_bit |