You are facing this error cause of your 'torchvision' and 'pytorch' version, they didn't match. So, you need to upgrade your 'torchvision' and 'pytorch' version to the new version. Just follow below code pip install --upgrade torch torchvision.