Solved by ptrblck in post #2 
              
              
                The error message points to a dtype mismatch in the inputs and model parameters. 
Note that numpy uses float64 by default and based on your code you are not transforming the numpy arrays to float32. 
Add x = torch.from_numpy(x).float() into your __getitem__ method and it should work.