class_docstr: Takes in final states and returns distribution over candidates.
docstr: Compute scores from inputs.
  
  :param input: (bsz x seq_len x num_directions * hiddensize) tensor of
                 states, e.g. the output states of an RNN
  
  :returns: (bsz x seqlen x num_cands) scores for each candidate
docstr_tok: ["Compute","scores","from","inputs",".",":","param","input",":","(","bsz","x","seq_len","x","num_directions","*","hiddensize",")","tensor","of","states",",","e.g",".","the","output","states","of","an","RNN",":","returns",":","(","bsz","x","seqlen","x","num_cands",")","scores","for","each","candidate"]
code: def forward(self, input):
      """
      Compute scores from inputs.
  
      :param input: (bsz x seq_len x num_directions * hiddensize) tensor of
                     states, e.g. the output states of an RNN
  
      :returns: (bsz x seqlen x num_cands) scores for each candidate
      """
      # next compute scores over dictionary
      if self.numsoftmax > 1:
          bsz = input.size(0)
          seqlen = input.size(1) if input.dim() > 1 else 1
  
          # first compute different softmax scores based on input vec
          # hsz => numsoftmax * esz
          latent = self.latent(input)
          active = self.dropout(self.activation(latent))
          # esz => num_features
          logit = F.linear(
              active.view(-1, self.esz), self.weight, self.bias
          )
  
          # calculate priors: distribution over which softmax scores to use
          # hsz => numsoftmax
          prior_logit = self.prior(input).view(-1, self.numsoftmax)
          # softmax over numsoftmax's
          prior = self.softmax(prior_logit)
  
          # now combine priors with logits
          prob = self.softmax(logit).view(
              bsz * seqlen, self.numsoftmax, -1
          )
          probs = (
              (prob * prior.unsqueeze(2)).sum(1).view(bsz, seqlen, -1)
          )
          scores = probs.log()
      else:
          # hsz => esz, good time for dropout
          e = self.dropout(self.o2e(input))
          # esz => num_features
          scores = F.linear(e, self.weight, self.bias)
  
      if self.padding_idx >= 0:
          scores[:, :, self.padding_idx] = neginf(scores.dtype)
  
      return scores
  
imports: import math
  import torch
  import torch.nn
  from torch.nn.parameter import Parameter
  from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence
  import torch.nn.functional
  from parlai.utils.torch import neginf
  from parlai.core.torch_generator_agent import TorchGeneratorModel
label_desc: Use image node_id 2 for calling the OutputLayer obj's underlying member method code with example usage: obj.forward(input) and returns: scores