code: def test_batch_one_hot(self, x, gc, dc):
      d = x.shape[1]
      lens = []
      vals = []
      for i in range(0, d):
          val = np.unique(x[:, i])
          vals.extend(val)
          lens.append(len(val))
      lens = np.array(lens, dtype=np.int32)
      vals = np.array(vals, dtype=np.int32)
  
      def ref(x, lens, vals):
          output_dim = vals.size
          ret = np.zeros((x.shape[0], output_dim)).astype(x.dtype)
          p = 0
          for i, l in enumerate(lens):
              for j in range(0, l):
                  v = vals[p + j]
                  ret[x[:, i] == v, p + j] = 1
              p += lens[i]
          return (ret,)
  
      op = core.CreateOperator(
          "BatchOneHot", ["X", "LENS", "VALS"], ["Y"]
      )
      self.assertReferenceChecks(gc, op, [x, lens, vals], ref)
  
file_path: pytorch/caffe2/python/operator_test/one_hot_ops_test.py
imports: from caffe2.python import core, workspace
  from caffe2.proto import caffe2_pb2
  from hypothesis import given, settings
  import caffe2.python.hypothesis_test_util
  import caffe2.python.serialized_test.serialized_test_util
  import hypothesis.strategies
  import numpy
label_desc: Use image node_id 1 for calling the TestOneHotOps obj's underlying member method code with example usage: obj.test_batch_one_hot(x, gc, dc) and returns: ret