class_docstr: Multi-headed attention.
  
  See "Attention Is All You Need" for more details.
class_docstr_tok: ["Multi-headed","attention",".","See","``","Attention","Is","All","You","Need","''","for","more","details","."]
docstr: Reorder buffered internal state (for incremental generation).
code: def reorder_incremental_state(
      self,
      incremental_state: Dict[str, Dict[str, Optional[Tensor]]],
      new_order: Tensor,
  ):
      """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():
              input_buffer_k = input_buffer[k]
              if input_buffer_k is not None:
                  if (
                      self.encoder_decoder_attention
                      and input_buffer_k.size(0) == new_order.size(0)
                  ):
                      break
                  input_buffer[k] = input_buffer_k.index_select(
                      0, new_order
                  )
          incremental_state = self._set_input_buffer(
              incremental_state, input_buffer
          )
      return incremental_state
  
imports: import __init__
  import math
  import uuid
  from typing import Dict, Optional, List
  import torch
  from torch import Tensor, nn
  from torch.nn import Parameter, LayerNorm, Dropout
  from csrc.pytorch import util
  from csrc.pytorch.layer_base import TransformerEmbeddingLayerBase, TransformerEncoderLayerBase, TransformerDecoderLayerBase
  from csrc.pytorch.quantization import QuantLinear, TensorQuantizer, act_quant_config, weight_quant_config, out_quant_config, emb_quant_config
label_desc: Use image node_id 7 for calling the MultiheadAttention obj's underlying member method code with example usage: obj.reorder_incremental_state(incremental_state, new_order) and returns: incremental_state