Skip to content

Basic observation on LeNet

Let's observe network variable by two utility functions get_activation_info and get_weight_info in mrfi.experiment.

get_activation_info(fi_model, input_data, method='MinMax', pre_hook=False, **kwargs)

Observe model activations without fault injection.

Parameters:

  • fi_model (MRFI) –

    Target model.

  • input_data (Union[torch.Tensor, DataLoader]) –

    A input tensor or a dataloader.

  • method (str) –

    Name of the basic observer in mrfi.observer.

  • pre_hook (bool) –

    Observer value in module input, not output.

  • **kwargs (dict) –

    Target module to observe, module_type, module_name or module_fullname

Returns:

  • dict

    Dictionary of observer result, keys are activation observation name and values are result of observer.result().

get_weight_info(model, method='MinMax', weight_name='weight', **kwargs)

Observe model weights.

Parameters:

  • model (Union[MRFI, torch.nn.Module]) –

    Target model.

  • method (str) –

    Name of the basic observer in mrfi.observer.

  • weight_name (Union[str, List[str]]) –

    Target weight name.

  • **kwargs (dict) –

    Target module to observe, module_type, module_name or module_fullname

Returns:

  • dict

    Dictionary of observer result, keys are weight observation and values are result of observer.result().

Observing by interactive Python program

In a jupyter environment, we obtain these information of each layer in LeNet:

  1. Shape of weights and activaitons
  2. Min/Max range of weights and activations
  3. Standard deviation of weights and activations
  4. Sampling value in tensor and visualize its distribution
  5. Visualize its feature map