From 18bf4e24ebfffab5b10d4515334cad9f94927adc Mon Sep 17 00:00:00 2001 From: Akshay Venkataraman Date: Sat, 17 Jun 2023 12:47:15 +0530 Subject: [PATCH] added all feature --- .../frontends/paddle/tensor/tensor.py | 4 ++ .../test_tensor/test_paddle_tensor.py | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/ivy/functional/frontends/paddle/tensor/tensor.py b/ivy/functional/frontends/paddle/tensor/tensor.py index 1878d3ecbb309..efd90b9508b59 100644 --- a/ivy/functional/frontends/paddle/tensor/tensor.py +++ b/ivy/functional/frontends/paddle/tensor/tensor.py @@ -167,3 +167,7 @@ def square(self, name=None): @with_supported_dtypes({"2.4.2 and below": ("float32", "float64")}, "paddle") def cholesky(self, upper=False, name=None): return ivy.cholesky(self._ivy_array, upper=upper) + + @with_supported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle") + def all(self, axis=None, keepdim=False, dtype=None, name=None): + return ivy.all(self.ivy_array, axis=axis, keepdims=keepdim, dtype=dtype) diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py index e7db7a29f0c2e..f8b1d36a9c1c3 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py @@ -843,3 +843,44 @@ def test_paddle_cholesky( method_flags=method_flags, on_device=on_device, ) + +# all +@handle_frontend_method( + class_tree=CLASS_TREE, + init_tree="paddle.to_tensor", + method_name="all", + dtype_x_axis=helpers.dtype_values_axis( + available_dtypes=st.one_of(helpers.get_dtypes("float")), + min_axis=-1, + max_axis=0, + min_num_dims=1, + force_int_axis=True, + ), + keep_dims=st.booleans(), +) +def test_paddle_all( + dtype_x_axis, + keep_dims, + frontend_method_data, + init_flags, + method_flags, + frontend, + on_device, +): + input_dtypes, x, axis = dtype_x_axis + helpers.test_frontend_method( + init_input_dtypes=input_dtypes, + init_all_as_kwargs_np={ + "object": x[0], + }, + method_input_dtypes=input_dtypes, + method_all_as_kwargs_np={ + "axis": axis, + "keepdim": keep_dims, + }, + frontend=frontend, + frontend_method_data=frontend_method_data, + init_flags=init_flags, + method_flags=method_flags, + on_device=on_device, + )