Can both the GPU and CPU versions of PyTorch be installed in the same Conda environment?

Viewed 2829

The PyTorch installation web page shows how to install the GPU and CPU versions of PyTorch:

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

and

conda install pytorch torchvision cpuonly -c pytorch

Can both version be installed in the same Conda environment?

In case you might ask why would this be needed, it's because I would like a single Conda environment which I can use on computers which have a GPU and those which don't.

1 Answers

The GPU version of PyTorch is actually a superset of the CPU PyTorch. You can use the GPU PyTorch on a CPU, but you cannot use the CPU PyTorch on a GPU. So in your case, installing just the GPU version of PyTorch would be sufficient.

Related