# Pytorch multiple targets

Cluj braila

Target: (N) where each value is 0≤targets[i]≤C−1. While here, in your criterion() function, you have a batchSize x 7 input and batchSize x 1 label. The confusing point is, say your batchSize is 10, a 10x1 tensor can not be regarded as a size-10 tensor, which is what the loss function expectes. You must explictly do the size conversion ...Example: RuntimeError: 1D target tensor expected, multi-target not supported site:stackoverflow.com. For nn.CrossEntropyLoss the target has to be a single number from the interval [0, Your target is [1, 0], thus PyTorch thinks you want to have multiple labels per input which is not supported. Replace your one-hot-encoded targets: [1, 0] --> 0 ...