reid-strong-baseline
reid-strong-baseline copied to clipboard
CrossEntropyLoss reduction write error
should
loss = (- targets * log_probs).mean(0).sum()
in https://github.com/michuanhaohao/reid-strong-baseline/blob/master/layers/triplet_loss.py#L146
be supposed to 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)