class_docstr: Abstract class for attention modules
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, new_order):
      """Reorder buffered internal state (for incremental generation)."""
      for incremental_clone_id in self.incremental_clone_ids:
          input_buffer = self._get_input_buffer(
              incremental_state,
              incremental_clone_id=incremental_clone_id,
          )
          if input_buffer is not None:
              for k in input_buffer.keys():
                  if (
                      torch.is_tensor(input_buffer[k])
                      and input_buffer[k].size(1) > 1
                  ):
                      input_buffer[k] = input_buffer[k].index_select(
                          1, new_order
                      )
              self._set_input_buffer(
                  incremental_state,
                  input_buffer,
                  incremental_clone_id=incremental_clone_id,
              )
  
imports: import torch
  import torch.nn.functional
  from fairseq import utils
  from fairseq.incremental_decoding_utils import with_incremental_state
  from torch import nn
label_desc: Use image node_id 3 for calling the AttentionAbstract obj's underlying member method code with example usage: obj.reorder_incremental_state(incremental_state, new_order) without return types