Skip to content

Commit

Permalink
Adding logical_not in paddle frontend (ivy-llc#17458)
Browse files Browse the repository at this point in the history
  • Loading branch information
MuhammadNizamani authored Jul 4, 2023
1 parent 8b09054 commit 09d2d3a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
18 changes: 17 additions & 1 deletion ivy/functional/frontends/paddle/tensor/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ def max(self, axis=None, keepdim=False, name=None):
def deg2rad(self, name=None):
return ivy.deg2rad(self._ivy_array)


@with_supported_dtypes(
{"2.5.0 and below": ("float32", "float64", "int32", "int64", "bool")}, "paddle"
)
Expand Down Expand Up @@ -478,3 +477,20 @@ def floor_divide(self, y, name=None):
@with_unsupported_dtypes({"2.4.2 and below": ("int16", "float16")}, "paddle")
def conj(self, name=None):
return ivy.conj(self._ivy_array)

@with_supported_dtypes(
{
"2.5.0 and below": (
"bool",
"int8",
"int16",
"int32",
"int64",
"float32",
"float64",
)
},
"paddle",
)
def logical_not(self, out=None, name=None):
return ivy.logical_not(self.ivy_array)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import ivy_tests.test_ivy.helpers as helpers
from ivy.functional.frontends.paddle import Tensor
from ivy_tests.test_ivy.helpers import handle_frontend_method
from ivy_tests.test_ivy.test_functional.test_experimental.test_core.test_manipulation import (
from ivy_tests.test_ivy.test_functional.test_experimental.test_core.test_manipulation import ( # noqa E501
_get_dtype_values_k_axes_for_rot90,
)

Expand Down Expand Up @@ -1981,8 +1981,8 @@ def test_paddle_deg2rad(
frontend=frontend,
on_device=on_device,
)


# rot90
@handle_frontend_method(
class_tree=CLASS_TREE,
Expand Down Expand Up @@ -2295,3 +2295,36 @@ def test_paddle_isnan(
frontend=frontend,
on_device=on_device,
)


# logical_not
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="logical_not",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("valid"),
),
)
def test_paddle_logical_not(
dtype_and_x,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_all_as_kwargs_np={
"data": x[0],
},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={},
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)

0 comments on commit 09d2d3a

Please sign in to comment.