-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Adding numeric gradient check util for python layers #5157
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
base: master
Are you sure you want to change the base?
Conversation
0ab9a2b
to
9308514
Compare
@shaibagon Very nice work.
|
@intbots thank you for your comment. I am fixing it now. |
…e include/caffe/test/test_gradient_check_util.hpp for complied layers.
9308514
to
316a09c
Compare
@xdtl it is very difficult to read your code when it is not formatted. |
Thank you for your reply! I found the problem was not caused by the gradient check. It's my bad. Sorry... |
I am getting "failed check" when I run it with EuclideanLossLayer from pyloss.py from caffe examples. The gradient test always estimates the double of the of the value computed by the layer's backward function.
I am testing using this script:
|
I am sorry but how can I install 'test_gradient_for_python_layer' module? |
@shaibagon , is there any reason why you hardcoded loss_weight to 2.0? Thanks |
@vimalthilak I picked |
Is there a reason why cmake/Modules/FindMKL.cmake is in this PR? |
adding a generic numerical gradient check for python layers. much like include/caffe/test/test_gradient_check_util.hpp for complied layers.
This utility can be used from python interface.
Numerically testing python layer's gradients.
How to use:
Suppose you have a python layer
Then you can test it's backward() gradients like this: