-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
enhancementNew feature or requestNew feature or request
Description
What do you think of also supporting `callable` methods as a parameter? In such case, we would be able to provide a default random generator based on input with something like:
class DeepLiftShap(Explainer):
SUPPORTED_MODULES = [Convolution]
def __init__(
self,
model: Module,
background_data: Optional[Tensor, Callable[[Tensor, Tensor], Tensor]] = None,
):
if background_data is None:
background_data = lambda x, y: torch.rand_like(x)
if torch.is_tensor(background_data):
background_data = lambda x, y: background_data
self.background_data = background_data
Originally posted by @enver1323 in #151 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request