code: def test_one_hot_forward(seed, inshape, shape, ctx, func_name):
      # Input
      input = np.zeros(inshape, dtype=int)
      rng = np.random.RandomState(seed)
  
      if len(shape) != inshape[-1]:
          # input inshape and shape don't match.
          with pytest.raises(RuntimeError):
              y = F.one_hot(nn.Variable(input.shape), shape)
      else:
          for i in range(inshape[-1]):
              # this input data contains out-of-range class index.
              num_classes = shape[i]
              low = -2 * num_classes
              high = 2 * num_classes
              input[:, i] = rng.randint(low, high, size=inshape[0])
          vinput = nn.Variable(input.shape, need_grad=False)
          vinput.d = input
  
          with nn.context_scope(ctx), nn.auto_forward():
              o = F.one_hot(vinput, shape)
          r = ref_one_hot(input, shape)
          assert_allclose(o.d, r)
          assert func_name == o.parent.name
  
file_path: nnabla/python/test/function/test_one_hot.py
imports: import pytest
  import numpy
  import nnabla
  import nnabla.functions
  from nbla_test_utils import list_context
  from nnabla.testing import assert_allclose
label_desc: Use image node_id 2 for calling a global function with example usage: test_one_hot_forward(seed, inshape, shape, ctx, func_name) without return types