def reorder_encoder_out(self, encoder_out, bert_outs, new_order):
    '\n        Reorder encoder output according to *new_order*.\n\n        Args:\n            encoder_out: output from the ``forward()`` method\n            new_order (LongTensor): desired order\n\n        Returns:\n            *encoder_out* rearranged according to *new_order*\n        '
    if (encoder_out['encoder_out'] is not None):
        encoder_out['encoder_out'] = encoder_out['encoder_out'].index_select(1, new_order)
    if (encoder_out['encoder_padding_mask'] is not None):
        encoder_out['encoder_padding_mask'] = encoder_out['encoder_padding_mask'].index_select(0, new_order)
    if (bert_outs['bert_encoder_out'] is not None):
        bert_outs['bert_encoder_out'] = bert_outs['bert_encoder_out'].index_select(1, new_order)
    if (bert_outs['bert_encoder_padding_mask'] is not None):
        bert_outs['bert_encoder_padding_mask'] = bert_outs['bert_encoder_padding_mask'].index_select(0, new_order)
    return (encoder_out, bert_outs)
Reorder encoder output according to *new_order*.

Args:
    encoder_out: output from the ``forward()`` method
    new_order (LongTensor): desired order

Returns:
    *encoder_out* rearranged according to *new_order*
def reorder_encoder_out(self, encoder_out, bert_outs, new_order):
    '\n        Reorder encoder output according to *new_order*.\n\n        Args:\n            encoder_out: output from the ``forward()`` method\n            new_order (LongTensor): desired order\n\n        Returns:\n            *encoder_out* rearranged according to *new_order*\n        '
    if (encoder_out['encoder_out'] is not None):
        encoder_out['encoder_out'] = encoder_out['encoder_out'].index_select(1, new_order)
    if (encoder_out['encoder_padding_mask'] is not None):
        encoder_out['encoder_padding_mask'] = encoder_out['encoder_padding_mask'].index_select(0, new_order)
    if (bert_outs['bert_encoder_out'] is not None):
        bert_outs['bert_encoder_out'] = bert_outs['bert_encoder_out'].index_select(1, new_order)
    if (bert_outs['bert_encoder_padding_mask'] is not None):
        bert_outs['bert_encoder_padding_mask'] = bert_outs['bert_encoder_padding_mask'].index_select(0, new_order)
    return (encoder_out, bert_outs)