huawei-noah / trustworthyAI

Trustworthy AI related projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: gae.py, matrices on different devices

Howardhuang98 opened this issue · comments

When I specify the device type = 'gpu' and run the gae.

ga = GAE(input_dim=1, hidden_dim=128, device_type="gpu", epochs=2) ga.learn(x)
Error:
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument mat1 in method wrapper_addmm)

I fixed it by modifying gae.py, line 160: x = torch.from_numpy(data) to x = torch.from_numpy(data).to(self.device)

Hello,

Thank you for the bug report and for taking the time to localize the issue! We will include your fix in the next version of the package.