Open AutumnZ-94 opened 3 years ago
should
loss = (- targets * log_probs).mean(0).sum() in https://github.com/michuanhaohao/reid-strong-baseline/blob/master/layers/triplet_loss.py#L146
loss = (- targets * log_probs).mean(0).sum()
be supposed to loss = (- targets * log_probs).sum(1).mean()?
loss = (- targets * log_probs).sum(1).mean()
@AutumnZ-94 Try this. They should be the same
x = torch.randn(32, 64) y1 = x.mean(0).sum() y2 = x.sum(1).mean() assert torch.allclose(y1, y2)
should
loss = (- targets * log_probs).mean(0).sum()
in https://github.com/michuanhaohao/reid-strong-baseline/blob/master/layers/triplet_loss.py#L146be supposed to
loss = (- targets * log_probs).sum(1).mean()
?