code: def one_hot(arr, num_classes=3):
      res = np.eye(num_classes)[np.array(arr).reshape(-1)]
      arr = res.reshape(list(arr.shape) + [num_classes])
      arr = arr.transpose((0, 4, 1, 2, 3)).astype(np.float32)
      return arr
  
file_path: tinygrad/examples/mlperf/metrics.py
imports: import re
  import string
  from collections import Counter
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: one_hot(arr, num_classes) and returns: arr