def __init__(self, forward_func: Callable) -> None: r""" Args: forward_func (callable): The forward function of the model or any modification of it """ FeatureAblation.__init__(self, forward_func) self.use_weights = True
def __init__(self, forward_func: Callable, perm_func: Callable = _permute_feature) -> None: r""" Args: forward_func (callable): The forward function of the model or any modification of it perm_func (callable, optional): A function that accepts a batch of inputs and a feature mask, and "permutes" the feature using feature mask across the batch. This defaults to a function which applies a random permutation, this argument only needs to be provided if a custom permutation behavior is desired. Default: `_permute_feature` """ FeatureAblation.__init__(self, forward_func=forward_func) self.perm_func = perm_func