Skip to content
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

weight_diff is treated differently in sphereface and in LargeMargin_softmax_loss #38

Open
cnsgus13 opened this issue Sep 23, 2017 · 2 comments

Comments

@cnsgus13
Copy link

why the weight_diff is treated seperately according to m (SINGLE, DOUBLE, etc) in LargeMargin_softmax_loss wheras in sphereface, it is treated the same?

@wy1iu
Copy link
Owner

wy1iu commented Sep 25, 2017

SINGLE, DOUBLE, etc correspond to the case of m=1, m=2, etc. It is simply for the convenience of implementation.

@cnsgus13
Copy link
Author

You did not get what I mean.

In sphereface, margin_inner_product_layer.cpp, line 277-278
you get gradient with respect to w using the same formula regardless of m: caffe_cpu_gemm(CblasTrans, CblasNoTrans, N_, K_, M_, (Dtype)1., top_diff, bottom_data, (Dtype)1., this->blobs_[0]->mutable_cpu_diff()); but

whereas in LargeMargin_softmax_loss, largemargin_inner_product_layer.cpp, line 263-356 you get gradient with respect to w according to m.

Can you tell me why?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants