IndexError: too many indices for tensor of dimension 2
zyx792726304 opened this issue · 0 comments
zyx792726304 commented
I run drloss on voc datasets with yolo,I replaced focal loss with drloss.
My input shape:
logits.shape = [564,20]
targets.shape = [564,20]
However:
Traceback (most recent call last):
File "a.py", line 17, in
print(drloss(input_tensor,target_tensor))
File "D:\anaconda\envs\zyx\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "utils\loss.py", line 235, in forward
pos_prob = logits[pos_ind].sigmoid()
IndexError: too many indices for tensor of dimension 2
What should I do to fix this?