KevinMusgrave / pytorch-metric-learning

The easiest way to use deep metric learning in your application. Modular, flexible, and extensible. Written in PyTorch.
https://kevinmusgrave.github.io/pytorch-metric-learning/
MIT License
5.96k stars 656 forks source link

Fixes the "nonzero is not supported for tensors with more than INT_MAX elements" in get_all_triplets_indices #689

Closed mkmenta closed 6 months ago

mkmenta commented 6 months ago

This solves #688

mkmenta commented 6 months ago

I am not sure if there could be other places where changing the torch.where could be beneficial (in case this implementation is accepted).

I think that in get_all_pairs_indices it would be hard to have a tensor with INT_MAX elements because the tensors used in the torch.where in this case are just len(labels)*len(ref_labels).

KevinMusgrave commented 6 months ago

Thanks!