Try printing out pred after the line pred = NNModel(X.to(device)), and see if it makes sense.
In fact, go through the run code, describe each line in words, try printing intermediate values to see if they match what you expect, and see if the real values match your expectations. Something in this code looks off to me, but I am too tired now to debug it in my mind.