The following code always allocates memory on device cuda:0, but I want to use another GPU for training
import torch
a = torch.randn([20000, 20000])
a.pin_memory() # <- this operation allocates memory on “cuda:0”, but I want to leave it unused.
b = a.cuda(‘cuda:1’)