code: def test_op_hardmax(sample, device_id, precision):
      t = AA(sample, dtype=PRECISION_TO_TYPE[precision])
      t_max = t.max()
  
      forward = np.zeros_like(t, dtype=PRECISION_TO_TYPE[precision])
  
      for i, x in enumerate(t):
          if x == t_max:
              forward[i] = 1
              break
  
      expected_forward = AA([forward])
  
      expected_backward = {"arg": [np.zeros_like(forward)]}
  
      from cntk import hardmax
  
      _test_unary_op(
          precision,
          device_id,
          hardmax,
          sample,
          expected_forward,
          expected_backward,
      )
  
imports: from __future__ import division
  import numpy
  import cntk
  import pytest
  from .ops_test_utils import unittest_helper, _test_unary_op, _test_binary_op, AA, precision, PRECISION_TO_TYPE, cntk_device
  from cntk.tests.test_utils import TOLERANCE_ABSOLUTE
  from cntk.internal.utils import eval
  from cntk.internal import sanitize_dtype_cntk
  from ..None import constant
  from cntk.variables import Parameter, Constant
label_desc: Use image node_id 25 for calling a global function with example usage: test_op_hardmax(sample, device_id, precision) without return types