From 58948abe80843a99b61e25dd9aa1978a4377dadc Mon Sep 17 00:00:00 2001 From: Ayam Date: Sat, 17 Jun 2023 12:07:16 +0530 Subject: [PATCH 1/2] argmin added #15044 --- .../frontends/paddle/tensor/search.py | 4 +++ .../test_tensor/test_paddle_search.py | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/ivy/functional/frontends/paddle/tensor/search.py b/ivy/functional/frontends/paddle/tensor/search.py index fda3b6ccfb11e..57946cd34d475 100644 --- a/ivy/functional/frontends/paddle/tensor/search.py +++ b/ivy/functional/frontends/paddle/tensor/search.py @@ -13,3 +13,7 @@ @to_ivy_arrays_and_back def argmax(x, /, *, axis=None, keepdim=False, dtype="int64", name=None): return ivy.argmax(x, axis=axis, keepdims=keepdim, dtype=dtype) + +@to_ivy_arrays_and_back +def argmin(x, /, *, axis=None, keepdim=False, dtype="int64", name=None): + return ivy.argmax(x, axis=axis, keepdims=keepdim, dtype=dtype) \ No newline at end of file diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_search.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_search.py index 82e0431cbc7fb..49e38738be40b 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_search.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_search.py @@ -35,3 +35,33 @@ def test_paddle_argmax( axis=axis, keepdim=keepdim, ) + +@handle_frontend_test( + fn_tree="paddle.argmin", + dtype_x_and_axis=helpers.dtype_values_axis( + available_dtypes=helpers.get_dtypes("valid"), + min_num_dims=1, + valid_axis=True, + force_int_axis=True, + ), + keepdim=st.booleans(), +) +def test_paddle_argmin( + dtype_x_and_axis, + keepdim, + frontend, + test_flags, + fn_tree, +): + # Skipped dtype test due to paddle functions only accepting str and np.ndarray, + # but test_frontend_function changes dtype kwargs to native dtype + input_dtypes, x, axis = dtype_x_and_axis + helpers.test_frontend_function( + input_dtypes=input_dtypes, + frontend=frontend, + test_flags=test_flags, + fn_tree=fn_tree, + x=x[0], + axis=axis, + keepdim=keepdim, + ) \ No newline at end of file From b64de0da4c7ffdb601283b52d601438a31dafbb2 Mon Sep 17 00:00:00 2001 From: Ayam Date: Sat, 17 Jun 2023 12:17:47 +0530 Subject: [PATCH 2/2] 2nd commit #15044 --- ivy/functional/frontends/paddle/tensor/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ivy/functional/frontends/paddle/tensor/search.py b/ivy/functional/frontends/paddle/tensor/search.py index 57946cd34d475..326d173dd02e7 100644 --- a/ivy/functional/frontends/paddle/tensor/search.py +++ b/ivy/functional/frontends/paddle/tensor/search.py @@ -16,4 +16,4 @@ def argmax(x, /, *, axis=None, keepdim=False, dtype="int64", name=None): @to_ivy_arrays_and_back def argmin(x, /, *, axis=None, keepdim=False, dtype="int64", name=None): - return ivy.argmax(x, axis=axis, keepdims=keepdim, dtype=dtype) \ No newline at end of file + return ivy.argmin(x, axis=axis, keepdims=keepdim, dtype=dtype) \ No newline at end of file