Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: invalid argument 1: cannot perform reduction function min on tensor with no elements because the operation does not have an identity at /root/pytorch/aten/src/THH/generic/THHTensorMathReduce.hip:65 #502

Open
rraminen opened this issue Apr 19, 2020 · 0 comments

Comments

@rraminen
Copy link
Contributor

In pascal.ipynb, the below error occurs

image

def _unpad(self, bbox_tgt, clas_tgt):
---> i = torch.min(torch.nonzero(clas_tgt-self.pad_idx))
return tlbr2cthw(bbox_tgt[i:]), clas_tgt[i:]-1+self.pad_idx

Reason:
This occurs when clas_tgt is tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], device='cuda:0') .
Then torch.nonzero(clas_tgt-self.pad_idx) becomes tensor([], device='cuda:0', size=(0, 1), dtype=torch.int64).
As torch.nonzero(clas_tgt-self.pad_idx) is an empty tensor, applying torch.min() on an empty tensor throws this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant