The code looks generally alright.
Could you describe what kind of transformation you are using for the dataset?
Since the data and target are both transformed, I assume that you are making sure that all random transformations are applied in the same way on both tensors?
Also, did you make sure that the target looks valid?
I would also recommend to try to overfit a small data sample (e.g. 10 samples) to make sure there are no bugs in the code we are missing.