code: def _reorder_cache(self, past: List[torch.Tensor], beam_idx):
      # if decoder past is not included in output
      # speedy decoding is disabled and no need to reorder
      reordered_decoder_past = []
      for state in past:
          reordered_decoder_past.append(state.index_select(0, beam_idx))
      return reordered_decoder_past
  
imports: import copy
  import itertools
  from typing import List, Optional, Tuple
  import torch
  import torch.nn.functional
  from transformers import BartConfig
  from transformers.generation import GenerationMixin
label_desc: Use image node_id 5 for calling the BARTBeamSearchGenerator obj's underlying member method code with example usage: obj._reorder_cache(past, beam_idx) and returns: reordered_decoder_past