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
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.
In pascal.ipynb, the below error occurs
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.