ValueError: Target size (torch.Size([128])) must be the same as input size (torch.Size([128, 10]))

I am using bcewithlogitsloss for classification , the output should be 0 or 1 .
I got this error!
any idea?
Thanks

It will be hard to determine what exactly is wrong without seeing the model. Could you post code of your model or specify what pytorch model are you using and what are your model’s input?