code: def one_hot(
      x, num_classes, on_value=1.0, off_value=0.0, device="cuda"
  ):
      x = x.long().view(-1, 1)
      return torch.full(
          (x.size()[0], num_classes), off_value, device=device
      ).scatter_(1, x, on_value)
  
imports: import collections.abc
  from typing import Any, Dict, Optional
  import numpy
  import torch
  from classy_vision.generic.util import convert_to_one_hot
  from torch.distributions.beta import Beta
  from vissl.data.collators import register_collator
  from .moco_collator import moco_collator
  from .simclr_collator import simclr_collator
label_desc: Use image node_id 4 for calling a global function with example usage: one_hot(x, num_classes, on_value, off_value, device) and returns: torch