How to switch to older version of pytorch?

how do I make sure that it uses gpu or a specific cua version?

Your original command

conda install -c pytorch pytorch=0.3.1 

would this one work?

conda install pytorch==1.6.0 torchvision cudatoolkit=10.2 -c pytorch

asking due to DDP deadlocks: Call to CUDA function failed. with DDP using 4 GPUs · Issue #54550 · pytorch/pytorch · GitHub

SO question: python - How to install older version of pytorch - Stack Overflow