I was suffering above (title) error during few hours.
The reason is wrong cuda version installed with pytorch.
My cuda version is 11.6, but install version is 11.7.
So I print it -> "torch.__version__"
It returend -> "1.13.1+cu117"
You can check your cuda version using this command
so, remove all torch, torchvision packaged
> pip uninstall torch torchvision
and install again
pip3 install torch torchvision torchaudio --extra-index-url \https://download.pytorch.org/whl/cu116
Then it works well.