chmncc.explanations package

Submodules

chmncc.explanations.gradients module

Module which deals with the explaination we can retrieve out of the images

chmncc.explanations.gradients.compute_integrated_gradient(batch_x: Tensor, batch_blank: Tensor, model: Module) Tensor[source]

Integrated gradients computation Implementation taken from https://github.com/CVxTz/IntegratedGradientsPytorch/blob/main/code/mlp_gradient.py

Parameters:
  • batch (batch_x [torch.Tensor] data instances) –

  • zeros (batch_blank [torch.Tensor] batch of) –

  • network (model [torch.nn.Module]) –

Returns:

integrated_gradients [torch.Tensor] integrated gradients

chmncc.explanations.gradients.output_gradients(inputs: Tensor, preds: Tensor) Tensor[source]

Compute the gradients with respect to the input

Parameters:
  • tensor (preds [torch.Tensor] output) –

  • tensor

Returns:

grad [torch.Tensor] gradients of the output with respect to the input

Module contents

Explainations For now, they are simply grandients based