YiwuZhong / Sub-GC

[ECCV 2020] Official code for "Comprehensive Image Captioning via Scene Graph Decomposition"
MIT License
94 stars 15 forks source link

Issue realted to torch.nn.utils.rnn.pack_padded_sequence #15

Closed Subeska closed 1 year ago

Subeska commented 1 year ago

_pack_padded_sequence() code line I faced RuntimeError: 'lengths' argument should be a 1D CPU int64 tensor, but got 1D cuda:0 Long tensor. how to resolve this error?

YiwuZhong commented 1 year ago

This error is due to the input is now on GPU but expected to be on CPU. To solve it, you can simply "a.cpu()" where a is the input tensor of your function.