def _cat_directions(self, h):
    ' If the encoder is bidirectional, do the following transformation.\n            (#directions * #layers, #batch, hidden_size) -> (#layers, #batch, #directions * hidden_size)\n        '
    if self.bidirectional_encoder:
        h = torch.cat([h[0:h.size(0):2], h[1:h.size(0):2]], 2)
    return h
If the encoder is bidirectional, do the following transformation.
(#directions * #layers, #batch, hidden_size) -> (#layers, #batch, #directions * hidden_size)
def _cat_directions(self, h):
    ' If the encoder is bidirectional, do the following transformation.\n            (#directions * #layers, #batch, hidden_size) -> (#layers, #batch, #directions * hidden_size)\n        '
    if self.bidirectional_encoder:
        h = torch.cat([h[0:h.size(0):2], h[1:h.size(0):2]], 2)
    return h