docstr: Calculated the labels 
code: def get_label(
      self,
      logits: Tensor,
      num_labels: int = -1,
      threshold: float = None,
  ) -> Tensor:
      """Calculated the labels"""
      if threshold:
          th_logit = torch.full((len(logits), 1), threshold)
      else:
          th_logit = logits[:, 0].unsqueeze(
              1
          )  # vector of predicted probabilities for class 0 (negative class)
      output = torch.zeros_like(logits).to(logits)
      mask = (
          logits > th_logit
      )  # for each sample: True, if prob for a class > prob for neg class, False otherwise
      if num_labels > 0:
          top_v, _ = torch.topk(
              logits, num_labels, dim=1
          )  # len(num_labels) max elements; sorted
          top_v = top_v[:, -1]  # the smallest pro for each sample
          mask = (
              logits >= top_v.unsqueeze(1)
          ) & mask  # mask + additionally: logits should be bigger than minimum
      output[mask] = 1.0
      output[:, 0] = (output.sum(1) == 0.0).to(
          logits
      )  # no relation if no label matched
      return output
  
file_path: DeepPavlov/deeppavlov/models/relation_extraction/losses.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
label_desc: Use image node_id 3 for calling the ATLoss obj's underlying member method code with example usage: obj.get_label(logits, num_labels, threshold) and returns: output