code: def test_mean_reduction():
      mean = lambda x, *args, **kwargs: tile(x.mean(*args, **kwargs))
  
      res = mean(ones((10, 8), chunk_size=3))
      assert res.shape == ()
      assert res.dtype is not None
      assert isinstance(res.chunks[0].op, TensorMean)
      assert isinstance(res.chunks[0].inputs[0].op, TensorConcatenate)
      assert isinstance(
          res.chunks[0].inputs[0].inputs[0].op, TensorMean
      )
      assert (
          res.chunks[0].inputs[0].inputs[0].op.stage
          == OperandStage.combine
      )
  
      res = mean(ones((8, 8), chunk_size=8))
      assert res.shape == ()
  
      res = mean(ones((10, 8), chunk_size=3), axis=0)
      assert res.shape == (8,)
  
      res = mean(ones((10, 8), chunk_size=3), axis=1)
      assert res.shape == (10,)
  
      with pytest.raises(np.AxisError):
          mean(ones((10, 8), chunk_size=3), axis=2)
  
      res = mean(ones((10, 8), chunk_size=3), axis=-1)
      assert res.shape == (10,)
  
      with pytest.raises(np.AxisError):
          mean(ones((10, 8), chunk_size=3), axis=-3)
  
      res = mean(ones((10, 8), chunk_size=3), keepdims=True)
      assert res.shape == (1, 1)
  
      res = mean(ones((10, 8), chunk_size=3), axis=0, keepdims=True)
      assert res.shape == (1, 8)
  
      res = mean(ones((10, 8), chunk_size=3), axis=1, keepdims=True)
      assert res.shape == (10, 1)
      assert isinstance(res.chunks[0].op, TensorMean)
      assert res.chunks[0].op.stage == OperandStage.agg
      assert isinstance(res.chunks[0].inputs[0].op, TensorConcatenate)
      assert isinstance(
          res.chunks[0].inputs[0].inputs[0].op, TensorMean
      )
      assert (
          res.chunks[0].inputs[0].inputs[0].op.stage == OperandStage.map
      )
  
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 2 for calling a global function with example usage: test_mean_reduction() without return types