DeepADoTS icon indicating copy to clipboard operation
DeepADoTS copied to clipboard

DGAMM-LSTM cannot run on gpu

Open yuehu9 opened this issue 4 years ago • 2 comments

When I tried to run DGAMM-LSTM on gpu I got the following message:

can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first

yuehu9 avatar Aug 07 '20 00:08 yuehu9

I faced the same issue with the plain DAGMM. Worked around this by adding .cpu() and .cuda() as follows in src/algorithms/dagmm.py:

Line 231: pinv = np.linalg.pinv(cov_k.data.cpu().numpy()) Line 243: cov_inverse = torch.cat(cov_inverse, dim=0).cuda()

I hope this helps you too.

FBallert avatar Aug 10 '20 14:08 FBallert

I faced the same issue with the plain DAGMM. Worked around this by adding .cpu() and .cuda() as follows in src/algorithms/dagmm.py:

Line 231: pinv = np.linalg.pinv(cov_k.data.cpu().numpy()) Line 243: cov_inverse = torch.cat(cov_inverse, dim=0).cuda()

I hope this helps you too.

This works, thanks!

yuehu9 avatar Aug 10 '20 15:08 yuehu9