I’m guessing that the variables predicted and annotations don’t have the same shape. Could you print their respective shape, just before that line is called?
Also, I think comparing tensors this way does not work. Apparently, predicted.eq(annotations).sum().item() might be what you’re looking for.