code: def reorder_state(self, indices: torch.LongTensor):
      if self.encoder_mask is not None:
          self.encoder_mask = self._reorder_state(
              self.encoder_mask, indices
          )
      if self.encoder_output is not None:
          self.encoder_output = self._reorder_state(
              self.encoder_output, indices
          )
      self.src_tokens = self._reorder_state(self.src_tokens, indices)
      if self.first is not None:
          self.first = self._reorder_state(self.first, indices)
      self.src_embed_outputs = self._reorder_state(
          self.src_embed_outputs, indices
      )
      if self.past_key_values is not None:
          new = []
          for layer in self.past_key_values:
              new_layer = {}
              for key1 in list(layer.keys()):
                  new_layer_ = {}
                  for key2 in list(layer[key1].keys()):
                      if layer[key1][key2] is not None:
                          layer[key1][key2] = self._reorder_state(
                              layer[key1][key2], indices
                          )
                      new_layer_[key2] = layer[key1][key2]
                  new_layer[key1] = new_layer_
              new.append(new_layer)
          self.past_key_values = new
  
imports: import torch
  from torch import nn
  from torch.nn import functional
  from transformers.models.bart.configuration_bart import BartConfig
  from .modeling_bart import BartModel
  from ..utils.util import avg_token_embeddings, seq_to_mask, get_model_device
  from functools import partial
  from typing import Union
label_desc: Use image node_id 3 for calling the PromptBartState obj's underlying member method code with example usage: obj.reorder_state(indices) without return types