diff --git a/ivy/functional/frontends/tensorflow/math.py b/ivy/functional/frontends/tensorflow/math.py index 1cbca0bc6a684..aec4596212ebb 100644 --- a/ivy/functional/frontends/tensorflow/math.py +++ b/ivy/functional/frontends/tensorflow/math.py @@ -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, @@ -425,6 +425,18 @@ 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"), + "2.9.0 and below": ("int8", "int16", "uint8", "uint16", "uint32", "uint64"), + }, + "tensorflow", +) +def abs(x, name=None): + return ivy.abs(x) + + @to_ivy_arrays_and_back def log_softmax(logits, axis=None): return ivy.log_softmax(logits, axis=axis) diff --git a/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_math.py b/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_math.py index ef2606467d74d..724be4ba3a8bc 100644 --- a/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_math.py +++ b/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_math.py @@ -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], + )