Solved by ptrblck in post #6 
              
              
                Ah OK, that would fit my expectation of the error and this would work: 
my_x = torch.stack([torch.rand(2,2),torch.rand(2,2)])
my_y = torch.stack([torch.rand(1), torch.rand(1)])
my_dataset = torch.utils.data.TensorDataset(my_x,my_y)

The error is raised, because tensors are expected, while you are pa…