I am using Pytorch. I got this RuntimeError while evaluating a model. Any idea how to solve this?
3 Answers
In my case, I got the error when calling loss.backward() and calling reshape didn't work. Possibly, because I couldn't find the correct tensor.
A temporary workaround was running on CPU instead of MPs. I definitely cannot recommend this as solution, because the code will then run on CPU, but it did remove the error message for now and might be useful for people's debugging:
I used:
device = torch.device("cpu")
The workaround:
device = torch.device("mps")