code: def test_op_reduce_over_batch_axis(input_data, device_id, precision):
      from .. import (
          reduce_sum,
          reduce_max,
          reduce_min,
          reduce_mean,
          reduce_log_sum_exp,
          reduce_prod,
      )
      from cntk import Axis
  
      dt = PRECISION_TO_TYPE[precision]
  
      data = AA(input_data, dtype=dt)
      a = C.input_variable(
          shape=data.shape[1:],
          dtype=sanitize_dtype_cntk(dt),
          needs_gradient=True,
          name="a",
      )
      ops = [
          (
              reduce_sum,
              lambda x: np.sum(x, axis=0, keepdims=False),
              lambda x, f: np.ones_like(x),
          ),
          (
              reduce_max,
              lambda x: np.amax(x, axis=0, keepdims=False),
              lambda x, f: min_max_bwd(x, f, dt),
          ),
          (
              reduce_min,
              lambda x: np.amin(x, axis=0, keepdims=False),
              lambda x, f: min_max_bwd(x, f, dt),
          ),
          (
              reduce_mean,
              lambda x: np.mean(x, axis=0, keepdims=False),
              lambda x, f: np.ones_like(x) / x.shape[0],
          ),
          (
              reduce_log_sum_exp,
              lambda x: np.log(
                  np.sum(np.exp(x), axis=0, keepdims=False)
              ),
              lambda x, f: np.exp(x - f),
          ),
          (
              reduce_prod,
              lambda x: np.prod(x, axis=0, keepdims=False),
              lambda x, f: f / x,
          ),
      ]
  
      for op, fwd, bwd in ops:
          input_op = op(a, axis=Axis.default_batch_axis())
          expected_forward = fwd(data)
          expected_backward = bwd(data, expected_forward)
          binding = {a: data}
          actual_backward = input_op.grad(binding)
          actual_forward = input_op.eval(binding)
          assert np.allclose(actual_forward, expected_forward)
          for ab, eb in zip(actual_backward, expected_backward):
              assert np.allclose(ab, eb)
  
imports: from __future__ import division
  import numpy
  import itertools
  import pytest
  import cntk
  from .ops_test_utils import unittest_helper, _test_unary_op, AA, precision, PRECISION_TO_TYPE, constant
  from cntk.internal import sanitize_dtype_cntk
  from ..None import reduce_sum, reduce_max, reduce_min, reduce_mean, reduce_log_sum_exp, reduce_prod
label_desc: Use image node_id 10 for calling a global function with example usage: test_op_reduce_over_batch_axis(input_data, device_id, precision) without return types