code: def convert_to_one_hot(
      pos_lbl, neg_lbl, num_classes: int
  ) -> torch.Tensor:
      """
      This function converts target class indices to one-hot vectors,
      given the number of classes.
          -> 1 for positive labels,
          -> 0 for negative and
          -> -1 for ignore labels.
      """
      one_hot_targets = torch.LongTensor(num_classes).zero_() - 1
      if isinstance(pos_lbl, list) and (len(pos_lbl) > 0):
          assert (
              max(pos_lbl) < num_classes
          ), "Class Index must be less than number of classes"
          one_hot_targets.scatter_(0, torch.Tensor(pos_lbl).long(), 1)
      if isinstance(neg_lbl, list) and (len(neg_lbl) > 0):
          assert (
              max(neg_lbl) < num_classes
          ), "Class Index must be less than number of classes"
          one_hot_targets.scatter_(0, torch.Tensor(neg_lbl).long(), 0)
      return one_hot_targets.squeeze()
  
imports: import torch
  from vissl.data.collators import register_collator
label_desc: Use image node_id 1 for calling a global function with example usage: convert_to_one_hot(pos_lbl, neg_lbl, num_classes) and returns: one_hot_targets