code: def onehot(indices, num_targets=None):
      """
      Converts index vector into one-hot matrix.
      """
      assert (
          indices.dtype == torch.long
      ), "indices must be long integers"
      assert indices.min() >= 0, "indices must be non-negative"
      if num_targets is None:
          num_targets = indices.max() + 1
      onehot_vector = torch.zeros(
          indices.nelement(), num_targets, dtype=torch.long
      )
      onehot_vector.scatter_(1, indices.view(indices.nelement(), 1), 1)
      return onehot_vector
  
imports: import multiprocessing
  import os
  import sys
  import tempfile
  import traceback
  import unittest
  import warnings
  from functools import wraps
  import crypten.communicator
  import crypten.debug
  import torch
  import torch.distributed
  from crypten.config import cfg
label_desc: Use image node_id 2 for calling a global function with example usage: onehot(indices, num_targets) and returns: onehot_vector