I want use your triplet_loss function to train a classification model with imagenet, and i got a mistake at triplet_loss.py line 70
dist_ap, relative_p_inds = torch.max((dist_mat * is_pos.float()).contiguous().view(N, -1), 1,keepdim=True)
if my label is [1, 1, 2, 3] then N=4 i got
RuntimeError: shape '[4, -1]' is invalid for input of size 6
if my label is [1, 1, 2, 2] and it worked
Is my understanding correct?Do I need to generate labels in this form[1,1,2,2]?
I want use your triplet_loss function to train a classification model with imagenet, and i got a mistake at triplet_loss.py line 70 dist_ap, relative_p_inds = torch.max((dist_mat * is_pos.float()).contiguous().view(N, -1), 1,keepdim=True) if my label is [1, 1, 2, 3] then N=4 i got RuntimeError: shape '[4, -1]' is invalid for input of size 6 if my label is [1, 1, 2, 2] and it worked Is my understanding correct?Do I need to generate labels in this form[1,1,2,2]?