def cuda(tensor):
if torch.cuda.is_available() and not os.getenv("NOCUDA", None):
return tensor.cuda()
else:
return tensor
After Change
def cuda(x):
if torch.cuda.is_available() and not os.getenv("NOCUDA", None):
return x.to(torch.device("cuda")) // works for both DGLGraph and tensor
else:
return tensor