IntegratedGradients#
- class txv.exp.IntegratedGradients(model: Module)#
Link to paper: Axiomatic Attribution for Deep Networks
- __init__(model: Module)#
- Parameters:
model (torch.nn.Module) – A model from
txv.vit
Tip
Use the model with
lrp=False
as LRP models have higher memory footprint.
- explain(input: Tensor, index: int | None = None, steps: int = 20, baseline: Tensor | None = None) Tensor #
- Parameters:
input (torch.Tensor) – Input tensor
index (int, optional) – Index of the class to explain, by default the predicted class is explained
steps (int, optional) – Number of steps in Riemann approximation of integral, by default 20
baseline (torch.Tensor, optional) – Baseline tensor, by default None(tensor of zeros)