code: def log_prob(self, inp):
      assert len(inp.size()) == 2
      head_out = self.head(inp)
      n = inp.size(0)
      prob = torch.zeros(n, self.cutoffs[-1]).to(
          textattack.shared.utils.device
      )
      lsm_head = log_softmax(head_out, dim=head_out.dim() - 1)
      prob.narrow(1, 0, self.output_size).add_(
          lsm_head.narrow(1, 0, self.output_size).data
      )
      for i in range(len(self.tail)):
          pos = self.cutoffs[i]
          i_size = self.cutoffs[i + 1] - pos
          buff = lsm_head.narrow(1, self.cutoffs[0] + i, 1)
          buff = buff.expand(n, i_size)
          temp = self.tail[i](inp)
          lsm_tail = log_softmax(temp, dim=temp.dim() - 1)
          prob.narrow(1, pos, i_size).copy_(buff.data).add_(
              lsm_tail.data
          )
      return prob
  
file_path: TextAttack/textattack/constraints/grammaticality/language_models/learning_to_write/adaptive_softmax.py
imports: import torch
  from torch import nn
  from torch.autograd import Variable
  from torch.nn.functional import log_softmax
  import textattack
label_desc: Use image node_id 5 for calling the AdaptiveSoftmax obj's underlying member method code with example usage: obj.log_prob(inp) and returns: prob