-
Notifications
You must be signed in to change notification settings - Fork 479
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
Neuron Conductance Tuple Support #602
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for woking on this PR, @vivekmig!
I left a small nit.
net, net.multi_relu, inp, lambda x: x[0][:, 1], [0.0, 6.0, 0.0] | ||
) | ||
lc = LayerConductance(net, net.multi_relu) | ||
print(lc.attribute(inp, target=0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this printout ? Did you wanted to assert with the results from Layer Conductance ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, good catch thanks! Was initially going to do that, but then made it a separate test, forgot to remove this.
self._conductance_input_test_assert( | ||
net, net.linear1, inp, lambda x: x[:, 0], [0.0, 90.0, 0.0] | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is a test model that has a custom layer which returns a tuple, could we, please, add a test for that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think both the other 2 added tests cover this case. Passing multi_input_module=True uses a custom layer MultiRelu, which returns a tuple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vivekmig has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
- a callable, which should | ||
take the target layer as input (single tensor or tuple | ||
if multiple tensors are in layer) and return a selected | ||
neuron (output shape should be 1D with length equal to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mismatched parens here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vivekmig has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This adds support for Neuron Conductance to allow a callable for selector function, as long as this function is used for selection rather than aggregation. This functionality allows neuron conductance to work with layers which may have input or output as a tuple of tensors.