Could you post the code where you are transforming your class indices to this multi-hot encoded format?
I would recommend to apply it somewhere beforehand on each target sample or in the __getitem__ of your Dataset, so that your training code will get the already processed targets.
Your criterion (nn.BCEWithLogitsLoss) expects the model output and target to have the same shape, so I guess the error is thrown somewhere using this criterion.
The scatter_ should work using my code. I’m not sure, why you get a scalar output.