From e39c49725d12562f4068a3e0fc5fa777b1689fd8 Mon Sep 17 00:00:00 2001 From: Selvaraj Date: Sun, 18 Jun 2023 20:19:01 +0530 Subject: [PATCH] imag-paddle-frontend --- .../frontends/paddle/tensor/attribute.py | 5 ++++ .../test_tensor/test_paddle_attribute.py | 25 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/ivy/functional/frontends/paddle/tensor/attribute.py b/ivy/functional/frontends/paddle/tensor/attribute.py index c23eb57f716b8..b88cc4ff3689d 100644 --- a/ivy/functional/frontends/paddle/tensor/attribute.py +++ b/ivy/functional/frontends/paddle/tensor/attribute.py @@ -8,3 +8,8 @@ @to_ivy_arrays_and_back def is_complex(x): return ivy.is_complex_dtype(x) + + +@to_ivy_arrays_and_back +def imag(x): + return ivy.imag(x) diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_attribute.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_attribute.py index 5565d7ff5a2aa..f18e12f371d0d 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_attribute.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_attribute.py @@ -28,3 +28,28 @@ def test_paddle_is_complex( on_device=on_device, x=input[0], ) + + +@handle_frontend_test( + fn_tree="paddle.tensor.attribute.imag", + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("valid"), + ), +) +def test_paddle_imag( + *, + dtype_and_x, + on_device, + fn_tree, + frontend, + test_flags, +): + input_dtype, input = dtype_and_x + helpers.test_frontend_function( + input_dtypes=input_dtype, + frontend=frontend, + test_flags=test_flags, + fn_tree=fn_tree, + on_device=on_device, + x=input[0], + )