It’s good to hear you figured it out!
A bit off-topic, but @rasbt showed some nice way to check for nan values, in case you didn’t use it:
a = torch.from_numpy(np.array([1.0, 2.0, np.nan]))
print(a != a) 
> tensor([ 0,  0,  1], dtype=torch.uint8)