Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: abs: tensorflow_frontend #10686

Merged
merged 6 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ivy/functional/frontends/tensorflow/math.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# global
import ivy
from ivy import with_supported_dtypes
from ivy import with_supported_dtypes, with_unsupported_dtypes
from ivy.functional.frontends.tensorflow import check_tensorflow_casting
from ivy.functional.frontends.tensorflow.func_wrapper import (
to_ivy_arrays_and_back,
Expand Down Expand Up @@ -425,6 +425,14 @@ def nextafter(x1, x2, name=None):
return ivy.nextafter(x1, x2)


@with_unsupported_dtypes(
{"1.2.0": ("float16", "complex64", "complex128"), "1.8.0 and below": ("float16")},
"tensorflow",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include the uints as unsupported from 2.9.0 and below in order to pass the test (i.e. uint8, uint16, ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was passed through the pre-commit hook

def abs(x, name=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the unit dtypes as unsupported dtypes.

return ivy.abs(x)


@to_ivy_arrays_and_back
def log_softmax(logits, axis=None):
return ivy.log_softmax(logits, axis=axis)
28 changes: 28 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_tensorflow/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,3 +1469,31 @@ def test_tensorflow_log_softmax(
on_device=on_device,
logits=x[0],
)


# abs
@handle_frontend_test(
fn_tree="tensorflow.math.abs",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("numeric"),
),
test_with_out=st.just(False),
)
def test_tensorflow_abs(
*,
dtype_and_x,
on_device,
fn_tree,
frontend,
test_flags,
):
input_dtype, x = 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,
rtol=1e-02,
x=x[0],
)