From d2f7aa35a64dae7c8e178545e2a6092c020c9c19 Mon Sep 17 00:00:00 2001 From: Anthony Okonneh <90141191+Anteemony@users.noreply.github.com> Date: Wed, 4 Oct 2023 19:42:12 +0000 Subject: [PATCH] Add paddle tolist --- .../frontends/paddle/manipulation.py | 5 ++++ .../test_paddle/test_manipulation.py | 26 +++++++++++++++++++ run_tests.py | 9 ++++--- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ivy/functional/frontends/paddle/manipulation.py b/ivy/functional/frontends/paddle/manipulation.py index fbf633158dbcd..46a5cc10b9114 100644 --- a/ivy/functional/frontends/paddle/manipulation.py +++ b/ivy/functional/frontends/paddle/manipulation.py @@ -180,6 +180,11 @@ def tile(x, repeat_times, name=None): return ivy.tile(x, repeats=repeat_times) +@to_ivy_arrays_and_back +def tolist(x): + return ivy.to_list(x) + + @with_supported_dtypes( {"2.5.1 and below": ("bool", "int32", "int64", "float16", "float32", "float64")}, "paddle", diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_manipulation.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_manipulation.py index af11f5e257e7d..413f799ef4d9d 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_manipulation.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_manipulation.py @@ -756,6 +756,32 @@ def test_paddle_tile( ) +@handle_frontend_test( + fn_tree="paddle.tolist", + dtype_and_x=helpers.dtype_and_values(available_dtypes=helpers.get_dtypes("valid")), + test_with_out=st.just(False), +) +def test_paddle_tolist( + *, + dtype_and_x, + on_device, + fn_tree, + backend_fw, + frontend, + test_flags, +): + x_dtype, x = dtype_and_x + helpers.test_frontend_function( + input_dtypes=x_dtype, + backend_to_test=backend_fw, + frontend=frontend, + test_flags=test_flags, + fn_tree=fn_tree, + on_device=on_device, + x=x[0], + ) + + # unbind @handle_frontend_test( fn_tree="paddle.unbind", diff --git a/run_tests.py b/run_tests.py index 62d981b03914b..1fcce91151666 100644 --- a/run_tests.py +++ b/run_tests.py @@ -158,13 +158,16 @@ def update_individual_test_results( fw for fw in BACKENDS if (fw != backend_name and fw != "paddle") ] for other_backend in other_backends: - backends.append(other_backend + "/" + get_latest_package_version(other_backend)) + backends.append( + other_backend + "/" + get_latest_package_version(other_backend) + ) print("Backends:", backends) command = ( f"docker run --rm --env REDIS_URL={redis_url} --env" - f' REDIS_PASSWD={redis_pass} -v "$(pwd)":/ivy/ivy unifyai/multiversion:latest' - f' /bin/bash -c "python multiversion_framework_directory.py {" ".join(backends)};cd' + f' REDIS_PASSWD={redis_pass} -v "$(pwd)":/ivy/ivy' + ' unifyai/multiversion:latest /bin/bash -c "python' + f" multiversion_framework_directory.py {' '.join(backends)};cd" f' ivy;pytest --tb=short {test} --backend={backend.strip()}"' ) print("Running", command)