Ptrblck
changing BCE to:
BCE = F.cross_entropy(out2, data_loss,size_average=True,reduction ='mean')

I get a different error:
RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 'target'

I have also removed the squeeze command, but this didn’t help. Am i right in assuming that i have to reformat the data_loss term to long as opposed to float, but this doesn’t make sense, does it?