code: def test_mindspore_avg_pool2d(
      dtype_x_k_s,
      count_include_pad,
      pad_mode,
      *,
      test_flags,
      frontend,
      backend_fw,
      fn_tree,
      on_device,
  ):
      input_dtype, x, kernel_size, stride, pad_name = dtype_x_k_s
  
      if len(stride) == 1:
          stride = (stride[0], stride[0])
  
      if pad_name == "SAME":
          padding = _calculate_same_padding(
              kernel_size, stride, x[0].shape[2:]
          )
      else:
          padding = (0, 0)
  
      x[0] = x[0].reshape(
          (x[0].shape[0], x[0].shape[-1], *x[0].shape[1:-1])
      )
  
      helpers.test_frontend_function(
          input_dtypes=input_dtype,
          backend_to_test=backend_fw,
          test_flags=test_flags,
          frontend=frontend,
          fn_tree=fn_tree,
          on_device=on_device,
          input=x[0],
          kernel_size=kernel_size,
          stride=stride,
          padding=padding,
          pad_mode=pad_mode,
          count_include_pad=count_include_pad,
          divisor_override=None,
      )
  
imports: from hypothesis import strategies
  import pytest
  import math
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_frontend_test
  from ivy_tests.test_ivy.test_functional.test_nn.test_layers import _assume_tf_dilation_gt_1
  import ivy
label_desc: Use image node_id 8 for calling a global function with example usage: test_mindspore_avg_pool2d(dtype_x_k_s, count_include_pad, pad_mode) without return types