harvardnlp / pytorch-struct

Fast, general, and tested differentiable structured prediction in PyTorch
http://harvardnlp.github.io/pytorch-struct
MIT License
1.11k stars 93 forks source link

RuntimeError when using pytorch-struct on GPU #121

Closed goncalomcorreia closed 2 years ago

goncalomcorreia commented 2 years ago

When I try to use topk or kmax on the GPU, the following error occurs:

ipdb> dist.kmax(5)
*** RuntimeError: Expected condition, x and y to be on the same device, but condition is on cpu and x and y are on cuda:0 and cuda:0 respectively
ipdb> dist.topk(5)
*** RuntimeError: Expected condition, x and y to be on the same device, but condition is on cpu and x and y are on cuda:0 and cuda:0 respectively

I'm not sure what the condition is in order to send it to the correct device.

srush commented 2 years ago

Not sure. I will take a look. Torch version?

goncalomcorreia commented 2 years ago

thanks for the fast reply :) this is with the latest torch version: 1.10.1