GHM_Loss.pytorch icon indicating copy to clipboard operation
GHM_Loss.pytorch copied to clipboard

input and target mismatch

Open wanglaotou opened this issue 5 years ago • 1 comments

ghm_loss.py", line 55, in _custom_loss_grad return torch.sigmoid(x).detach() - target RuntimeError: The size of tensor a (2) must match the size of tensor b (208) at non-singleton dimension 1 hi, my input size is [208,2] and target size is [208], and i got error like this. could you please tell me how to fix this error?

wanglaotou avatar Dec 19 '19 09:12 wanglaotou

ghm_loss.py", line 55, in _custom_loss_grad return torch.sigmoid(x).detach() - target RuntimeError: The size of tensor a (2) must match the size of tensor b (208) at non-singleton dimension 1 hi, my input size is [208,2] and target size is [208], and i got error like this. could you please tell me how to fix this error?

The shape of input and target should be same. You can refer to binary-cross-entropy-with-logits

DHPO avatar Dec 25 '19 02:12 DHPO