Hey guys,
I’m pretty new at Pytorch. I’m coming from Tensorflow.
I want my code to be device agnostic.
I am following this tutorial: https://pytorch.org/docs/stable/notes/cuda.html 8
Basically, using .to(device) everywhere.
However, I realized that I can just:

Run on CPU with export CUDA_VISIBLE_DEVICES=;

Run on GPU with export CUDA_VISIBLE_DEVICES=0;


Exactly like in Tensorflow where the code for CPU/GPU is -roughly- the same.
Why do people bother with .to(device) or .type()?
I may understand why if we deal with multiple GPUs and want to have a finer-grained management of the GPUs.
But in the simple case, doesn’t the code get bloated and less readable?
Philippe