哪个是正确的 tripletLoss 反向传播公式?
Which is right tripletLoss backpropagation formula?
我看到了
对于梯度,anchor是n-p
,positive是p-a
,negative是a-n
.
但是从80行到92行的tripletLossLayer
就和这个不一样了。
即,对于梯度锚点是p - n
,正向是p - a
。
哪一个是真的?
triplet_loss_layer.cpp
中的第 80-92 行是 forward_cpu
函数的一部分——这是实际的损失计算而不是梯度计算。
在backward_cpu
, where you can see that each bottom
is assigned its diff
according to the derivation presented 中计算梯度。
我看到了n-p
,positive是p-a
,negative是a-n
.
但是从80行到92行的tripletLossLayer
就和这个不一样了。
即,对于梯度锚点是p - n
,正向是p - a
。
哪一个是真的?
triplet_loss_layer.cpp
中的第 80-92 行是 forward_cpu
函数的一部分——这是实际的损失计算而不是梯度计算。
在backward_cpu
, where you can see that each bottom
is assigned its diff
according to the derivation presented