class_docstr: Implements MultiHeadAttention; this is the core workhorse of the Transformer.
  
  See Vaswani (2017) for an extensive description.
class_docstr_tok: ["Implements","MultiHeadAttention",";","this","is","the","core","workhorse","of","the","Transformer",".","See","Vaswani","(","2017",")","for","an","extensive","description","."]
docstr: Reorder the input incremental-state tensors.
docstr_tok: ["Reorder","the","input","incremental-state","tensors","."]
code: def reorder_incremental_state(
      self,
      incremental_state: Dict[str, torch.Tensor],
      inds: torch.Tensor,
  ) -> Dict[str, torch.Tensor]:
      """
      Reorder the input incremental-state tensors.
      """
      return {
          key: torch.index_select(
              val, 0, inds.to(val.device)
          ).contiguous()
          for key, val in incremental_state.items()
      }
  
file_path: ParlAI/parlai/agents/transformer/modules/attention.py
imports: import math
  from typing import Dict, Tuple, Optional, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from parlai.core.opt import Opt
  from parlai.core.params import default
  from parlai.utils.torch import neginf
label_desc: Use image node_id 3 for calling the MultiHeadAttention obj's underlying member method code with example usage: obj.reorder_incremental_state(incremental_state, inds) and returns: unknown