In lstm.py, shouldn't be the dimensions of h and c depend on the number of directions, as mentioned in the comment?
"h of shape [num_layers*num_directions, batch_size, hidden_size] holds the initial hidden state ...
c of shape [num_layers*num_directions, batch_size, hidden_size] holds the initial cell state"
Hence, it should be:
num_directions = 1 + self.bidirectional
if hx is None:
ih = x.new_zeros(self.num_layers * num_directions, batch_size, self.hidden_size)
h, c = ih, ih
else:
h, c = self.permute_hidden(hx, sequence.sorted_indices)
h = h.view(self.num_layers, num_directions, batch_size, self.hidden_size)
c = c.view(self.num_layers, num_directions, batch_size, self.hidden_size)
In lstm.py, shouldn't be the dimensions of h and c depend on the number of directions, as mentioned in the comment? "
h
of shape[num_layers*num_directions, batch_size, hidden_size]
holds the initial hidden state ...c
of shape[num_layers*num_directions, batch_size, hidden_size]
holds the initial cell state"Hence, it should be: