class_docstr: ExampleModel implements the abstract methods of TorchGeneratorModel to define how to
  re-order encoder states and decoder incremental states.
  
  It also instantiates the embedding table, encoder, and decoder, and defines the
  final output layer.
class_docstr_tok: ["ExampleModel","implements","the","abstract","methods","of","TorchGeneratorModel","to","define","how","to","re-order","encoder","states","and","decoder","incremental","states",".","It","also","instantiates","the","embedding","table",",","encoder",",","and","decoder",",","and","defines","the","final","output","layer","."]
docstr: Reorder the encoder states to select only the given batch indices.
  
  Since encoder_state can be arbitrary, you must implement this yourself.
  Typically you will just want to index select on the batch dimension.
docstr_tok: ["Reorder","the","encoder","states","to","select","only","the","given","batch","indices",".","Since","encoder_state","can","be","arbitrary",",","you","must","implement","this","yourself",".","Typically","you","will","just","want","to","index","select","on","the","batch","dimension","."]
code: def reorder_encoder_states(self, encoder_states, indices):
      """
      Reorder the encoder states to select only the given batch indices.
  
      Since encoder_state can be arbitrary, you must implement this yourself.
      Typically you will just want to index select on the batch dimension.
      """
      h, c = encoder_states
      return h[:, indices, :], c[:, indices, :]
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  import torch.nn
  import torch.nn.functional
  import parlai.core.torch_generator_agent
label_desc: Use image node_id 3 for calling the ExampleModel obj's underlying member method code with example usage: obj.reorder_encoder_states(encoder_states, indices) and returns: h,  c