class_docstr: Model parallel Multi-headed attention.
  This performs the Multi-headed attention over multiple gpus.
  
  See "Megatron-LM: https://arxiv.org/pdf/1909.08053.pdf" for more details.
class_docstr_tok: ["Model","parallel","Multi-headed","attention",".","This","performs","the","Multi-headed","attention","over","multiple","gpus",".","See","``","Megatron-LM",":","https",":","\/\/arxiv.org\/pdf\/1909.08053.pdf","''","for","more","details","."]
docstr: Reorder buffered internal state (for incremental generation).
docstr_tok: ["Reorder","buffered","internal","state","(","for","incremental","generation",")","."]
code: def reorder_incremental_state(
      self,
      incremental_state: Dict[str, Dict[str, Optional[Tensor]]],
      new_order,
  ):
      """Reorder buffered internal state (for incremental generation)."""
      input_buffer = self._get_input_buffer(incremental_state)
      if input_buffer is not None:
          for k in input_buffer.keys():
              if input_buffer[k] is not None:
                  input_buffer[k] = input_buffer[k].index_select(
                      0, new_order
                  )
          incremental_state = self._set_input_buffer(
              incremental_state, input_buffer
          )
      return incremental_state
  
file_path: fairseq/fairseq/model_parallel/modules/multihead_attention.py
imports: from typing import Dict, Optional, Tuple
  import torch
  import torch.nn.functional
  from torch import Tensor, nn
  from fairseq import utils
  from fairseq.incremental_decoding_utils import with_incremental_state
  from fairseq.modules.fairseq_dropout import FairseqDropout
label_desc: Use image node_id 4 for calling the ModelParallelMultiheadAttention obj's underlying member method code with example usage: obj.reorder_incremental_state(incremental_state, new_order) and returns: incremental_state