code: def onehot(indices):
      """
      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"
      onehot_vector = torch.zeros(
          indices.nelement(), indices.max() + 1, dtype=torch.uint8
      )
      onehot_vector.scatter_(1, indices.view(indices.nelement(), 1), 1)
      return onehot_vector
  
file_path: CrypTen/examples/util.py
imports: import logging
  import os
  import numpy
  import numpy.linalg
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: onehot(indices) and returns: onehot_vector