Explainability

Functionality to help with both global and local explainability.


source

get_attribution_map


def get_attribution_map(
    model, modules, x, y:NoneType=None, detach:bool=True, cpu:bool=False, apply_relu:bool=True
):

Call self as a function.


source

get_acts_and_grads


def get_acts_and_grads(
    model, modules, x, y:NoneType=None, detach:bool=True, cpu:bool=False
):

Returns activations and gradients for given modules in a model and a single input or a batch. Gradients require y value(s). If they are not provided, it will use the predictions.