code: def test_one_hot_legacy():
      np.random.seed(42)
      for device in ["cpu", "gpu"]:
          for j in range(
              1, 5
          ):  # test 1..4 levels of nested 'multi-dimensional' scalars
              layout = get_initial_layout(j)
  
              class RandomScalarLikeTensors:
                  def __init__(self, i):
                      self.i = i
  
                  def __call__(self):
                      return random_scalar_like_tensors_batch(self.i)
  
              for i in range(5):
                  yield partial(
                      check_one_hot_operator,
                      axis=None,
                      axis_name="O",
                      expected_output_dim=1,
                      initial_layout=layout,
                  ), RandomScalarLikeTensors(j), device
  
imports: from functools import partial
  from nvidia.dali.pipeline import Pipeline
  import nvidia.dali.ops
  import nvidia.dali.types
  from test_utils import check_batch
  from nose_utils import raises
  import numpy
label_desc: Use image node_id 11 for calling a global function with example usage: test_one_hot_legacy() and returns: random_scalar_like_tensors_batch