Hello,
I use torch 1.8.1+cuda10.2+torchtext0.9.1
Platform: Windows 10
Device: GeForce GTX 1050
This code
packed_embedded = nn.utils.rnn.pack_padded_sequence(input=embedded, lengths=text_lengths)

raises the error: “‘lengths’ argument should be a 1D CPU int64 tensor, but got 0D cpu Long tensor.”
I tried the following approaches:
#approach no 1:
text_lengths = torch.as_tensor(text_lengths, dtype=torch.int64, device='cpu')
packed_embedded = nn.utils.rnn.pack_padded_sequence(embedded, text_lengths)

#approach no 2:
lengths=text_lengths.cpu()

#approach no 3:
packed_embedded = nn.utils.rnn.pack_padded_sequence(embedded, torch.as_tensor(text_lengths.cpu(), dtype=torch.int64))

#approach no 4:
packed_embedded = nn.utils.rnn.pack_padded_sequence(embedded, text_lengths.type(torch.FloatTensor))

but without success.
I checked the value of
text_lengths.type()

in train() and the model and  all the time it has the value of
torch.LongTensor

, no matter what I tried to change it.
Is there any other workaround for this problem?
thank you