-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Contributions Scores for Middle Layer #30
Comments
Yes, it possible to use an intermediate hidden layer as input to generate attributions (indeed, this is necessary for layers that stop gradient propagation, ie. embedding lookups) For example, when you have an embedding lookup you need to run first your model up to the interest hidden layer, take the numerical result at that point, and use it when calling If that is not clear enough, it would be helpful to see a snippet of your code to check where the problem is. |
Thanks for the reply! So this is the normal code which works fine
And this is how I modify it to get the contributions at the conv layer at layer [-7]
The error message is
For some background here, I'm using the pre-trained VGG16 model. I modified the last two layers to be a separate dense and activation layer (softmax) with the usual 1000 classes. The variable |
I don't see an obvious problem with your code. Seems you have some disconnected operations on the graph but that should not happen with within that snipped of code. Could you provide a minimal working example that I can run? Also, is the problem still there if you use |
Thanks a lot for the help again. Here's a fully coded example with the error. The same error occurs with
|
I'm just going to bump this in case! Thanks again for the help. |
Is it possible to use DeepExplain to get contribution scores for a layer in the middle of the network?
I presume you have to change this line
target_tensor = fModel(input_tensor)
But if I replace input_tensor with a conv layer like model.layers[-7].input (for example) I get the error message.
ValueError: number of input channels does not match corresponding dimension of filter
Is it possible to do this?
The text was updated successfully, but these errors were encountered: