You need to wrap the data with transforms.Compose before you return it.
For example add to the __init__:
self.transform = transforms.Compose([transforms.ToTensor()])  # you can add to the list all the transformations you need. 

and in __getitem__ do:
return self.transform(self.x_data[index]), self.transform(self.y_data[index])

Didn’t try it on your code but I think it should work.