Make sure that mlp_train_inputs and mlp_train_targets are Tensors, i.e they weren’t wrapped with torch.autograd.Variable or produced by an operation using Variables.
Or if they are Variables and that has to be so, pass them as TensorDataset(mlp_train_inputs.data, mlp_train_targets.data)