code: def test_base_reduction():
      sum = lambda x, *args, **kwargs: tile(x.sum(*args, **kwargs))
      prod = lambda x, *args, **kwargs: tile(x.prod(*args, **kwargs))
      max = lambda x, *args, **kwargs: tile(x.max(*args, **kwargs))
      min = lambda x, *args, **kwargs: tile(x.min(*args, **kwargs))
      all = lambda x, *args, **kwargs: tile(x.all(*args, **kwargs))
      any = lambda x, *args, **kwargs: tile(x.any(*args, **kwargs))
  
      for f in [sum, prod, max, min, all, any]:
          res = f(ones((8, 8), chunk_size=8))
          assert res.shape == ()
  
          res = f(ones((10, 8), chunk_size=3))
          assert res.dtype is not None
          assert res.shape == ()
  
          res = f(ones((10, 8), chunk_size=3), axis=0)
          assert res.shape == (8,)
  
          res = f(ones((10, 8), chunk_size=3), axis=1)
          assert res.shape == (10,)
  
          with pytest.raises(np.AxisError):
              f(ones((10, 8), chunk_size=3), axis=2)
  
          res = f(ones((10, 8), chunk_size=3), axis=-1)
          assert res.shape == (10,)
  
          with pytest.raises(np.AxisError):
              f(ones((10, 8), chunk_size=3), axis=-3)
  
          res = f(ones((10, 8), chunk_size=3), keepdims=True)
          assert res.shape == (1, 1)
  
          res = f(ones((10, 8), chunk_size=3), axis=0, keepdims=True)
          assert res.shape == (1, 8)
  
          res = f(ones((10, 8), chunk_size=3), axis=1, keepdims=True)
          assert res.shape == (10, 1)
  
          res = f(ones((10, 8, 10), chunk_size=3), axis=1)
          assert res.shape == (10, 10)
  
          res = f(
              ones((10, 8, 10), chunk_size=3), axis=1, keepdims=True
          )
          assert res.shape == (10, 1, 10)
  
          res = f(ones((10, 8, 10), chunk_size=3), axis=(0, 2))
          assert res.shape == (8,)
  
          res = f(
              ones((10, 8, 10), chunk_size=3),
              axis=(0, 2),
              keepdims=True,
          )
          assert res.shape == (1, 8, 1)
  
file_path: mars/mars/tensor/reduction/tests/test_reduction.py
imports: import numpy
  import pytest
  from ....core import tile
  from ....core.operand import OperandStage
  from ...datasource import ones, tensor
  from ...merge import TensorConcatenate
  from ..None import all, TensorMean, TensorArgmax, TensorArgmin
label_desc: Use image node_id 1 for calling a global function with example usage: test_base_reduction() without return types