Pytorch was installed using pip install torch torchvision, but I did not use the GPU. I reinstalled it using pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html, and gc works without freeze. I still get the warning, though.