I have the following code:
gruLayer = nn.GRU(input_size = 4, hidden_size = 32, num_layers = 2, bidirectional=False, batch_first=True)
print(f"{arr_input.shape}, {arr_seq_len.shape}")
pack = nn.utils.rnn.pack_padded_sequence(arr_input, arr_seq_len, batch_first=True, enforce_sorted=False)
print(f"{pack.data.shape}, {pack.batch_sizes.shape}")
out, h = gruLayer(pack)
print(f"{out.data.shape}, {h.shape}")
With the following outputs:
torch.Size([256, 90, 4]), torch.Size([256])
torch.Size([10179, 4]), torch.Size([89])
torch.Size([10179, 32]), torch.Size([2, 256, 32])
I don’t understand why the output of pack_padded_sequence
(data and batch_sizes):
torch.Size([10179, 4]), torch.Size([89])
why it’s not data = (904256) and (batch_sizes = 256)
?