class_docstr: Adaptive variant of `UniformRegularizer` which learns the mix-in noise distribution.
  
  Learning Better Structured Representations using Low-Rank Adaptive Label Smoothing
  (Ghoshal+ 2021; https://openreview.net/pdf?id=5NsEIflpbSv)
class_docstr_tok: ["Adaptive","variant","of","`","UniformRegularizer","`","which","learns","the","mix-in","noise","distribution",".","Learning","Better","Structured","Representations","using","Low-Rank","Adaptive","Label","Smoothing","(","Ghoshal+","2021",";","https",":","\/\/openreview.net\/pdf","?","id=5NsEIflpbSv",")"]
code: def __call__(self, logits, targets, reduce=True):
      mask = targets.ne(self.ignore_index)
  
      if self.label_embedding is None:
          # Initialize label embedding matrix to ones.
          num_labels = logits.shape[1]
          self.label_embedding = nn.Parameter(
              torch.ones(num_labels, self.label_embedding_dim),
              requires_grad=True,
          ).to(device=logits.device, dtype=logits.dtype)
  
      loss = self.compute_adaptive_loss(
          logits,
          targets,
          F.dropout(self.label_embedding, self.label_embedding_dropout),
      )
  
      if reduce:
          return (
              loss[mask].mean()
              if mask.any()
              else torch.tensor(0.0, device=logits.device)
          )
  
      return loss
  
file_path: pytext/pytext/loss/regularizer.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from pytext.config import ConfigBase
  from .loss import Loss
label_desc: Use image node_id 3 for calling the AdaptiveRegularizer obj's underlying member method code with example usage: obj.__call__(logits, targets, reduce) and returns: loss, unknown