Repository: ivy-llc/ivy

Issue:
adaptive_avg_pool2d
Close #20804


Discussion:
![image](https://github.com/unifyai/ivy/assets/65773452/a87acc70-d315-4514-a824-0df1b1f7fdbb)


When I test it locally its working, Can you help me write the ivy test since Mindspore seems to be not included as Backend in Tests. At least, thats the error I got when I wrote tests and decided to exclude them in my PR. I also noticed that the Mindspore test file is all commented and no tests are written.
the same values produce the same results in jupyter
![image](https://github.com/unifyai/ivy/assets/65773452/d0c2c1f3-6c11-4e95-b858-32c655969948)

@Ishticode will anyone review this pull request?
This issue has been labelled as stale. If you would like to continue working on this issue, then please add another comment or create a PR . If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. For more information please refer to this page in our documentation: https://lets-unify.ai/ivy/contributing/1_the_basics.html#todo-list-issues
> 

@ivy-seed I have been waiting for this issue to be assigned to someone and review but to no vail for a month now
#20804

Resolving patch:
diff --git a/ivy/functional/frontends/mindspore/ops/function/nn_func.py b/ivy/functional/frontends/mindspore/ops/function/nn_func.py
--- a/ivy/functional/frontends/mindspore/ops/function/nn_func.py
+++ b/ivy/functional/frontends/mindspore/ops/function/nn_func.py
@@ -40,4 +40,10 @@ def softsign(x):
 @with_supported_dtypes({"2.0 and below": ("int8", "int16", "int32", "int64", "float16", "float32", "float64")}, "mindspore")
 @to_ivy_arrays_and_back
 def pad(input, pad_width, mode='constant', constant_values=0):
-    return ivy.pad(input, pad_width, mode=mode, constant_values=constant_values)
\ No newline at end of file
+    return ivy.pad(input, pad_width, mode=mode, constant_values=constant_values)
+
+
+@with_supported_dtypes({"2.0.0 and below": ("float16", "float32", "float64")}, "mindspore")
+@to_ivy_arrays_and_back
+def adaptive_avg_pool2d(input, output_size):
+    return ivy.adaptive_avg_pool2d(input, output_size)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_mindspore/test_ops/test_function/test_mindspore_nn_func.py b/ivy_tests/test_ivy/test_frontends/test_mindspore/test_ops/test_function/test_mindspore_nn_func.py
--- a/ivy_tests/test_ivy/test_frontends/test_mindspore/test_ops/test_function/test_mindspore_nn_func.py
+++ b/ivy_tests/test_ivy/test_frontends/test_mindspore/test_ops/test_function/test_mindspore_nn_func.py
@@ -116,3 +116,43 @@
 #         mode=mode,
 #         constant_values=constant_values,
 #     )
+
+
+# adaptive_avg_pool2d
+# @handle_frontend_test(
+#     fn_tree="mindspore.ops.function.nn_func.adaptive_avg_pool2d",
+#     dtype_and_x=helpers.dtype_and_values(
+#         available_dtypes=helpers.get_dtypes("float"),
+#         min_num_dims=4,
+#         max_num_dims=4,
+#         min_dim_size=1,
+#         max_value=100,
+#         min_value=-100,
+#     ),
+#     output_size=st.one_of(
+#         st.tuples(
+#             helpers.ints(min_value=1, max_value=5),
+#             helpers.ints(min_value=1, max_value=5),
+#         ),
+#         helpers.ints(min_value=1, max_value=5),
+#     ),
+# )
+# def test_mindspore_adaptive_avg_pool2d(
+#     *,
+#     dtype_and_x,
+#     output_size,
+#     test_flags,
+#     frontend,
+#     on_device,
+#     fn_tree,
+# ):
+#     input_dtype, x = dtype_and_x
+#     helpers.test_frontend_function(
+#         input_dtypes=input_dtype,
+#         frontend=frontend,
+#         test_flags=test_flags,
+#         on_device=on_device,
+#         fn_tree=fn_tree,
+#         x=x[0],
+#         output_size=output_size,
+#     )