code: def reorder_encoder_states(self, encoder_out, indices):
      enc, mask, ckattn = encoder_out
      if not th.is_tensor(indices):
          indices = th.LongTensor(indices).to(enc.device)
      enc = th.index_select(enc, 0, indices)
      mask = th.index_select(mask, 0, indices)
      ckattn = th.index_select(ckattn, 0, indices)
      return enc, mask, ckattn
  
file_path: ParlAI/projects/wizard_of_wikipedia/generator/modules.py
imports: from typing import Dict
  import numpy
  import torch
  import torch.nn
  from parlai.utils.torch import neginf
  from parlai.agents.transformer.modules import TransformerGeneratorModel
label_desc: Use image node_id 2 for calling the EndToEndModel obj's underlying member method code with example usage: obj.reorder_encoder_states(encoder_out, indices) and returns: enc,  mask,  ckattn