class_docstr: TransformerGeneratorModel with a classifier head on top of the decoder.
  
  Useful for performing classification with a pretrained generator model.
class_docstr_tok: ["TransformerGeneratorModel","with","a","classifier","head","on","top","of","the","decoder",".","Useful","for","performing","classification","with","a","pretrained","generator","model","."]
docstr: Get output class logits from the model.
  
  :param xs:
      - list of inputs to the encoder/decoder. Elements:
        - text_vec: (LongTensor[bsz, text seqlen])
  :return:
      - the model's predicted per-class scores.
        (FloatTensor[bsz, len(class_list)])
docstr_tok: ["Get","output","class","logits","from","the","model",".",":","param","xs",":","-","list","of","inputs","to","the","encoder\/decoder",".","Elements",":","-","text_vec",":","(","LongTensor","[","bsz",",","text","seqlen","]",")",":","return",":","-","the","model","'s","predicted","per-class","scores",".","(","FloatTensor","[","bsz",",","len","(","class_list",")","]",")"]
code: def forward(self, *xs):
      """
      Get output class logits from the model.
  
      :param xs:
          - list of inputs to the encoder/decoder. Elements:
            - text_vec: (LongTensor[bsz, text seqlen])
      :return:
          - the model's predicted per-class scores.
            (FloatTensor[bsz, len(class_list)])
      """
  
      # All tokens go into the encoder and classification is learned from that.
      assert len(xs) == 1
      # Only one input allowed
      bsz = xs[0].size(0)
      encoder_states = self.encoder(*xs)
      inputs = self.START.detach().expand(bsz, 1)
      # Generate most likely class given start token as input
      latent, _ = self.decoder(inputs, encoder_states)
      # latent: [bsz, seqlen, emb_dim]
      scores = self.classifier_head(latent.squeeze(dim=1))
  
      return scores
  
imports: from parlai.core.params import ParlaiParser
  import random
  from typing import List, Optional
  import numpy
  import torch
  from torch import nn
  from parlai.agents.transformer.modules import TransformerDecoder, TransformerGeneratorModel
  from parlai.core.agents import Agent
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.torch_classifier_agent import ConfusionMatrixMetric, WeightedF1Metric
  from parlai.utils.misc import warn_once
label_desc: Use image node_id 3 for calling the ClassifierOnGeneratorModel obj's underlying member method code with example usage: obj.forward() and returns: scores