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

about diff #11

Open
zjz5250 opened this issue Nov 20, 2017 · 0 comments
Open

about diff #11

zjz5250 opened this issue Nov 20, 2017 · 0 comments

Comments

@zjz5250
Copy link

zjz5250 commented Nov 20, 2017

@xiaolonw
if(tloss1 > 0)
{
for(int k = 0; k < dim; k ++)
{
fori_diff[k] += (fneg[k] - fpos[k]); // / (pairNum * 1.0 - 2.0);
fpos_diff[k] += -fori[k]; // / (pairNum * 1.0 - 2.0);
fneg_diff[k] += fori[k];
}
}
if(tloss2 > 0)
{
for(int k = 0; k < dim; k ++)
{
fori_diff[k] += -fpos[k]; // / (pairNum * 1.0 - 2.0);
fpos_diff[k] += fneg[k]-fori[k]; // / (pairNum * 1.0 - 2.0);
fneg_diff[k] += fpos[k];
}
}
为什么loss1与loss2大于0时,计算梯度的方式不一致呢?
loss = f(a).f(n)-f(a).f(p)
那求偏导后,loss1>0是,diff的计算与上述loss相同,loss2>0时的计算公式是怎么得来呢?
多谢啦

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

1 participant