Hi,
When you do y_pred = torch.Tensor(list(y_pred)) you convert the Tensor to a python list and then back to a Tensor. But we cannot track gradients in the python list and so this breaks the gradient computation.
You can just use y_pred as is. Or if you want to make it 1D use y_pred = y_pred.view(-1).