Hi everyone,
I see that there is a pack_sequence utility function used with Recurrent neural nets. There is a simple example 27 to demonstrate usage of it. However, it does not include the word embedding usage. When I try to do the following I got an error:
import torch
import torch.nn.utils.rnn as rnn_utils
import torch.nn as nn


embeddings = nn.Embedding(6,10)
lstm = nn.LSTM(10, 200,num_layers=1, bidirectional=True)


a = torch.Tensor([[1], [2], [3]])
b = torch.Tensor([[4], [5]])
c = torch.Tensor([[6]])
packed = rnn_utils.pack_sequence([a, b, c])
emb  = embeddings(packed) # This line raises an error


Error message: TypeError: embedding(): argument ‘indices’ (position 2) must be Tensor, not PackedSequence


If I was succesful on the above line, I was going to give it as an input to lstm as below:

packed_output, (h,c) = lstm(emb)