original_docstring: 
          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*
          
docstring: Reorder encoder output according to *new_order*.
docstring_tokens: Reorder encoder output according to * new_order * .
code: def reorder_encoder_out(self, encoder_out: EncoderOut, new_order):
          """
          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*
          """
          """
          Since encoder_padding_mask and encoder_embedding are both of type
          Optional[Tensor] in EncoderOut, they need to be copied as local
          variables for Torchscript Optional refinement
          """
          encoder_padding_mask: Optional[Tensor] = encoder_out.encoder_padding_mask
          encoder_embedding: Optional[Tensor] = encoder_out.encoder_embedding
  
          new_encoder_out = (
              encoder_out.encoder_out
              if encoder_out.encoder_out is None
              else encoder_out.encoder_out.index_select(1, new_order)
          )
          new_encoder_padding_mask = (
              encoder_padding_mask
              if encoder_padding_mask is None
              else encoder_padding_mask.index_select(0, new_order)
          )
          new_encoder_embedding = (
              encoder_embedding
              if encoder_embedding is None
              else encoder_embedding.index_select(0, new_order)
          )
          src_tokens = encoder_out.src_tokens
          if src_tokens is not None:
              src_tokens = src_tokens.index_select(0, new_order)
  
          src_lengths = encoder_out.src_lengths
          if src_lengths is not None:
              src_lengths = src_lengths.index_select(0, new_order)
  
          encoder_states = encoder_out.encoder_states
          if encoder_states is not None:
              for idx, state in enumerate(encoder_states):
                  encoder_states[idx] = state.index_select(1, new_order)
  
          return EncoderOut(
              encoder_out=new_encoder_out,  # T x B x C
              encoder_padding_mask=new_encoder_padding_mask,  # B x T
              encoder_embedding=new_encoder_embedding,  # B x T x C
              encoder_states=encoder_states,  # List[T x B x C]
              src_tokens=src_tokens,  # B x T
              src_lengths=src_lengths,  # B x 1
          )
code_tokens: def reorder_encoder_out ( self , encoder_out : EncoderOut , new_order ) : """
          Since encoder_padding_mask and encoder_embedding are both of type
          Optional[Tensor] in EncoderOut, they need to be copied as local
          variables for Torchscript Optional refinement
          """ encoder_padding_mask : Optional [ Tensor ] = encoder_out . encoder_padding_mask encoder_embedding : Optional [ Tensor ] = encoder_out . encoder_embedding new_encoder_out = ( encoder_out . encoder_out if encoder_out . encoder_out is None else encoder_out . encoder_out . index_select ( 1 , new_order ) ) new_encoder_padding_mask = ( encoder_padding_mask if encoder_padding_mask is None else encoder_padding_mask . index_select ( 0 , new_order ) ) new_encoder_embedding = ( encoder_embedding if encoder_embedding is None else encoder_embedding . index_select ( 0 , new_order ) ) src_tokens = encoder_out . src_tokens if src_tokens is not None : src_tokens = src_tokens . index_select ( 0 , new_order ) src_lengths = encoder_out . src_lengths if src_lengths is not None : src_lengths = src_lengths . index_select ( 0 , new_order ) encoder_states = encoder_out . encoder_states if encoder_states is not None : for idx , state in enumerate ( encoder_states ) : encoder_states [ idx ] = state . index_select ( 1 , new_order ) return EncoderOut ( encoder_out = new_encoder_out , encoder_padding_mask = new_encoder_padding_mask , encoder_embedding = new_encoder_embedding , encoder_states = encoder_states , src_tokens = src_tokens , src_lengths = src_lengths , )
short_docstring: Reorder encoder output according to *new_order*.
short_docstring_tokens: Reorder encoder output according to * new_order * .
comment: """
          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*
          """$SEP$"""
          Since encoder_padding_mask and encoder_embedding are both of type
          Optional[Tensor] in EncoderOut, they need to be copied as local
          variables for Torchscript Optional refinement
          """$SEP$# T x B x C$SEP$# B x T$SEP$# B x T x C$SEP$# List[T x B x C]$SEP$# B x T$SEP$# B x 1