code: def one_hot(inputs, vocab_size=None):
      """Returns one hot of data over each element of the inputs"""
      if vocab_size is None:
          vocab_size = inputs.max() + 1
      input_shape = inputs.shape
      inputs = inputs.flatten().unsqueeze(1).long()
      z = torch.zeros(len(inputs), vocab_size, device=inputs.device)
      z.scatter_(1, inputs, 1.0)
      return z.view(*input_shape, vocab_size)
  
file_path: DIG/dig/ggraph/method/GraphDF/model/df_utils.py
imports: import sys
  import warnings
  import torch
  import torch.nn.functional
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: one_hot(inputs, vocab_size) and returns: z