docstr: Parameters
  ----------
  logits : ``torch.Tensor``, required.
      A tensor of unnormalized log probabilities of shape (batch_size, ..., num_classes).
  mask: ``torch.Tensor``, optional (default = None).
      A masking tensor of shape (batch_size, ...).
docstr_tok: ["Parameters","--","--","--","--","--","logits",":","``","torch.Tensor","``",",","required",".","A","tensor","of","unnormalized","log","probabilities","of","shape","(","batch_size",",","...",",","num_classes",")",".","mask",":","``","torch.Tensor","``",",","optional","(","default","=","None",")",".","A","masking","tensor","of","shape","(","batch_size",",","...",")","."]
code: def __call__(self, logits, mask=None):  # type: ignore
      """
      Parameters
      ----------
      logits : ``torch.Tensor``, required.
          A tensor of unnormalized log probabilities of shape (batch_size, ..., num_classes).
      mask: ``torch.Tensor``, optional (default = None).
          A masking tensor of shape (batch_size, ...).
      """
      logits, mask = self.unwrap_to_tensors(logits, mask)
  
      if mask is None:
          mask = torch.ones(logits.size()[:-1])
  
      log_probs = torch.nn.functional.log_softmax(logits, dim=-1)
      probabilities = torch.exp(log_probs) * mask.unsqueeze(-1)
      weighted_negative_likelihood = -log_probs * probabilities
      entropy = weighted_negative_likelihood.sum(-1)
  
      self._entropy += entropy.sum() / mask.sum()
      self._count += 1
  
file_path: magnitude/pymagnitude/third_party/allennlp/training/metrics/entropy.py
imports: from __future__ import division
  from __future__ import absolute_import
  import torch
  from allennlp.training.metrics.metric import Metric
label_desc: Use image node_id 2 for calling the Entropy obj's underlying member method code with example usage: obj.__call__(logits, mask) without return types