Spaces:
Build error
Build error
Download captum/attr/_utils/custom_modules.py from markytools/strexp: direct link, hf CLI and curl.
- Browser
- Download file 394 Bytes
-
https://huggingface.co/spaces/markytools/strexp/resolve/main/captum/attr/_utils/custom_modules.py
- Command line
-
hf download hf://spaces/markytools/strexp/captum/attr/_utils/custom_modules.py
-
curl -L -o custom_modules.py https://huggingface.co/spaces/markytools/strexp/resolve/main/captum/attr/_utils/custom_modules.py
394 Bytes
| #!/usr/bin/env python3 | |
| import torch.nn as nn | |
| class Addition_Module(nn.Module): | |
| """Custom addition module that uses multiple inputs to assure correct relevance | |
| propagation. Any addition in a forward function needs to be replaced with the | |
| module before using LRP.""" | |
| def __init__(self) -> None: | |
| super().__init__() | |
| def forward(self, x1, x2): | |
| return x1 + x2 | |