microsoft / otdd

Optimal Transport Dataset Distance
MIT License
156 stars 48 forks source link

Solved RuntimeError: zero-dimensional tensor cannot be concatenated #27

Open jmamath opened 2 years ago

jmamath commented 2 years ago

When applying OTDD on a small dataset, it might happen that the last item of the labels might be of the form tensor(k) instead of tensor([k]) with k a torch.int64. In such case, it would produce the following error: RuntimeError: zero-dimensional tensor (at position 1) cannot be concatenated.

To avoid that, I created a dumb dimension for the last item.