Binary label: Tensor type?
Hello, It seems to be a minor issue. I’m training a toy siamese network. My label is either -1 or 1, so I was using a LongTensor to store the label. It seems to me that torch complains because target is supposed to be a FloatTensor? (torch.cuda.LongTensor tensor, int value)
didn’t match because some of the arguments have invalid types: (torch.cuda.LongTensor, float) (torch.cuda.LongTensor tensor, torch.cuda.LongTensor other)
didn’t match because some of the arguments have invalid types: (torch.cuda.LongTensor, float) (torch.cuda.LongTensor tensor, int value)
didn’t match because some of the arguments have invalid types: (torch.cuda.LongTensor, float) (torch.cuda.LongTensor tensor, torch.cuda.LongTensor other)
didn’t match because some of the arguments have invalid types: (torch.cuda.LongTensor, float) Thanks!
lg-zhang
What loss are you using? I think casting the target to a FloatTensor should fix it.
apaszke
I assumed that a binary label should be an integer until it complains. Thanks!
lg-zhang