code: def forward(self, inp, target):
      n = inp[0].size(0)
      target = self.remap_target(target.data)
      loss = 0
      for i in range(len(inp)):
          if inp[i] is not None:
              assert target[i].min() >= 0 and target[i].max() <= inp[
                  i
              ].size(1)
              criterion = self.criterions[i]
              loss += criterion(inp[i], Variable(target[i]))
      loss /= n
      return loss
  
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 4 for calling the AdaptiveLoss obj's underlying member method code with example usage: obj.forward(inp, target) and returns: loss