the return of your collate_fn should be a tensor and not a python list, as the model doesn’t work directly on python list. The return should be “return torch.tensor(data), torch.tensor(target)”. You also have to transfer the tensor before you pass it to the model to the device, it should be “outputs = mlp(x.to(device))”;