code: def ref_top_n_error(x, l, axis, n):
      orig_x = x.copy()
      x = np.rollaxis(x, axis, x.ndim).reshape(-1, x.shape[axis])
      ll = np.rollaxis(l, axis, x.ndim).flatten()
      y = []
      for x_, ll_ in zip(x, ll):
          threshold = x_[ll_]
          count = 0
          for x__ in x_:
              if x__ >= threshold:
                  count += 1
          y.append(1 if count > n else 0)
      return np.array(y).reshape(l.shape)
  
file_path: nnabla/python/test/function/test_top_n_error.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 1 for calling a global function with example usage: ref_top_n_error(x, l, axis, n) and returns: np