Does the training look alright, i.e. do you get predictions for both classes?
I’m not sure, why you are squeezing the target, but I assume you have somehow an additional dimension in your data?
If the training looks fine, did you make sure to apply the same transformation during training and evaluation?
The code looks alright. At least I cannot find any obvious bugs.