在Pytorch-Lightning中,您通常不必指定 cuda 或 gpu。但是当我想创建一个高斯采样张量时,torch.normal
我得到
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
那么,我该如何更改才能torch.normal
使 pytorch-lightning 正常工作?因为我在 cpu和gpu上的不同机器上使用代码
centers = data["centers"] #already on GPU... sometimes...
lights = torch.normal(0, 1, size=[100, 3])
lights += centers