Video 45: In the training loop, I am getting a RuntimeError. #1147
Replies: 1 comment
-
Ok, I found the error here!! It says that it requires a Tensor to process the training of model but you are passing a numpy ndarray, so its mismatching the conditions. You can do one thing, just convert the numpy ndarray to Tensor by adding this following line :
This will convert your numpy ndarray into a Tensor and will solve the problem. But you output variable has size of 50, so just check it once whether its correct or not , As I think it must be of size 1 Thus, I have also changed in the line of tensor y as :
If still any problem occurs, feel free to message me. Hope this helps!! |
Beta Was this translation helpful? Give feedback.
-
I am getting an error in the line
training_predictions = model(X_train)
in the feed-forward step of the training loop.The error is
RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.
Beta Was this translation helpful? Give feedback.
All reactions