Hi guys,
I’m new to PyTorch and i’m trying to grasp PackedSequence.
I have a batch of some sentences with variable length, which I wanna translate into PackedSequence, so i can feed them into an RNN.
The longest sentence in the batch is 11 words. Dimension of my word vectors are [1, 240] each.
I have padded each sentence to match the length of the longest sequence therefore my input Tensor is:
# batch_size, max_len, num_features
batch_in.size()
torch.Size([100, 11, 240])

packed_seq = nn.utils.rnn.pack_padded_sequence(batch_in, batch_in_lengths,batch_first=True)
And the output of packed_seq:
PackedSequence(data=Variable containing:
 3.1625e-01 -4.8614e-01  4.9205e-01  ...  -3.2214e-01 -1.0503e+00 -7.7392e-01
-2.3958e-01 -5.7964e-01 -1.1852e+00  ...  -4.7232e-02 -8.6795e-01  9.3440e-03
-2.3958e-01 -5.7964e-01 -1.1852e+00  ...  -4.7232e-02 -8.6795e-01  9.3440e-03
                ...                   ⋱                   ...                
-5.1679e-01  7.7076e-01  4.5970e-01  ...  -3.2855e-01  8.4874e-01  2.6562e-01
 7.2816e-01 -5.6678e-01 -1.5125e+00  ...   3.1464e-01 -6.4921e-01 -1.1999e+00
 1.2031e+00 -1.0457e-01  5.2758e-01  ...  -5.4365e-01  7.4296e-01  1.9522e-01
[torch.DoubleTensor of size 379x240]
, batch_sizes=[100, 100, 100, 42, 13, 10, 7, 3, 2, 1, 1])

Can somebody explain me why the batch_sizes looks the way it does?