Comments (5)
I guess that this is actually a bit cumbersome. One way would be to break the network up into multiple lrp.Sequential
s and then use the intermediate outputs to reference their output.grad
variables.
It relates to this post about obtaining grads (explanations in our case) and this post about getting intermediate outputs of pretrained networks.
I would be happy to discuss if there is a better way to structure this code such that similar tasks become easier.
from torchlrp.
hey, thanks for the answer!
yes, "cumbersome" is the right word here!
pull request #3 gets the job done, but it's kind of hack-ish... not sure if there's a better/more elegant way to do it!
from torchlrp.
I have merged your pull request although I never liked global
variables. In this case, however, it does make sense to some extend. Thanks for the contribution!
I will integrate your code a bit more and push an update soon.
In particular, the trace should be done in all backward computations and not only for the Epsilon rule.
from torchlrp.
The best way would be to pass a list to fill with the trace when calling backward
-- that way, we would not need global variables:
tl=[]
y_hat.backward(trace_list=tl)
However, I think backward
up there calls PyTrorch's backward
first, which then calls your own backward
. If this is the case, PyTorch's function will throw a TypeError
exception upon seeing the extra parameter.
from torchlrp.
Yes, this is exactly the issue.
from torchlrp.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchlrp.