docstr: Same as the one in transformer.py, with new_sentemb
docstr_tok: ["Same","as","the","one","in","transformer.py",",","with","new_sentemb"]
code: def reorder_encoder_out(
      self, encoder_out: Dict[str, List[Tensor]], new_order
  ):
      """
      Same as the one in transformer.py, with new_sentemb
      """
      if len(encoder_out["sentemb"]) == 0:
          new_sentemb = []
      else:
          new_sentemb = [
              encoder_out["sentemb"][0].index_select(0, new_order)
          ]
  
      return {
          "sentemb": new_sentemb,  # B x C
      }
  
imports: import logging
  from typing import Any, Dict, List, Optional
  from torch import Tensor
  import torch
  import torch.nn
  from fairseq.models import FairseqEncoderDecoderModel, register_model, register_model_architecture
  from fairseq.models.transformer import base_architecture, Embedding, TransformerModel, TransformerEncoder, TransformerDecoder
  from fairseq.modules import TransformerDecoderLayer
label_desc: Use image node_id 3 for calling the LaserTransformerEncoder obj's underlying member method code with example usage: obj.reorder_encoder_out(encoder_out, new_order) and returns: dict