From bcb126cdd744f4d316d2dacfa8af81d1986265d3 Mon Sep 17 00:00:00 2001 From: Jay Choy <91728831+ZJay07@users.noreply.github.com> Date: Fri, 1 Mar 2024 19:14:45 +0000 Subject: [PATCH 1/4] fixed tensorflow.math.softplus --- ivy/functional/frontends/tensorflow/math.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ivy/functional/frontends/tensorflow/math.py b/ivy/functional/frontends/tensorflow/math.py index 3a0118409774f..c7820b19ee359 100644 --- a/ivy/functional/frontends/tensorflow/math.py +++ b/ivy/functional/frontends/tensorflow/math.py @@ -868,6 +868,15 @@ def softmax(logits, axis=None, name=None): return ivy.softmax(logits, axis=axis) +@with_supported_dtypes( + { + "2.15.0 and below": ( + "float32", + "float64", + ) + }, + "tensorflow", +) @to_ivy_arrays_and_back def softplus(features, name=None): return ivy.softplus(features) From 7c9eee64e18e331771c65b7f036e3e17ec24dd30 Mon Sep 17 00:00:00 2001 From: Jay Choy <91728831+ZJay07@users.noreply.github.com> Date: Sun, 17 Mar 2024 10:07:59 +0000 Subject: [PATCH 2/4] skip float16 if backend is paddle --- ivy/functional/frontends/tensorflow/math.py | 1 + ivy_tests/test_ivy/test_frontends/test_tensorflow/test_math.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ivy/functional/frontends/tensorflow/math.py b/ivy/functional/frontends/tensorflow/math.py index c7820b19ee359..cc059e6f218a2 100644 --- a/ivy/functional/frontends/tensorflow/math.py +++ b/ivy/functional/frontends/tensorflow/math.py @@ -871,6 +871,7 @@ def softmax(logits, axis=None, name=None): @with_supported_dtypes( { "2.15.0 and below": ( + "float16", "float32", "float64", ) 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 3d14053f47e38..9f9291d556da0 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 @@ -2858,6 +2858,8 @@ def test_tensorflow_softplus( on_device, ): input_dtype, x = dtype_and_x + if backend_fw == "paddle" and "float16" in input_dtype: + return helpers.test_frontend_function( input_dtypes=input_dtype, backend_to_test=backend_fw, From e18029f8a151002f22e2ee7010b390892b33c8a5 Mon Sep 17 00:00:00 2001 From: Jay Choy <91728831+ZJay07@users.noreply.github.com> Date: Mon, 25 Mar 2024 18:15:31 +0000 Subject: [PATCH 3/4] proper fix --- ivy/functional/backends/paddle/activations.py | 13 +++++++++++++ .../test_frontends/test_tensorflow/test_math.py | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ivy/functional/backends/paddle/activations.py b/ivy/functional/backends/paddle/activations.py index 8ddaff5b70a09..8dace1e706230 100644 --- a/ivy/functional/backends/paddle/activations.py +++ b/ivy/functional/backends/paddle/activations.py @@ -117,6 +117,19 @@ def softmax( return paddle.divide(exp_x, paddle.sum(exp_x, axis=axis, keepdim=True)) +@with_supported_dtypes( + { + "2.6.0 and below": ( + "int32", + "int64", + "float64", + "complex128", + "float32", + "complex64", + ) + }, + backend_version, +) def softplus( x: paddle.Tensor, /, 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 9f9291d556da0..3d14053f47e38 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 @@ -2858,8 +2858,6 @@ def test_tensorflow_softplus( on_device, ): input_dtype, x = dtype_and_x - if backend_fw == "paddle" and "float16" in input_dtype: - return helpers.test_frontend_function( input_dtypes=input_dtype, backend_to_test=backend_fw, From 3b4bfcc3c821c89c33d8bcc46f58d4fe96abf16c Mon Sep 17 00:00:00 2001 From: Jay Choy <91728831+ZJay07@users.noreply.github.com> Date: Mon, 25 Mar 2024 18:20:56 +0000 Subject: [PATCH 4/4] removed unecessary code --- ivy/functional/frontends/tensorflow/math.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/ivy/functional/frontends/tensorflow/math.py b/ivy/functional/frontends/tensorflow/math.py index cc059e6f218a2..3a0118409774f 100644 --- a/ivy/functional/frontends/tensorflow/math.py +++ b/ivy/functional/frontends/tensorflow/math.py @@ -868,16 +868,6 @@ def softmax(logits, axis=None, name=None): return ivy.softmax(logits, axis=axis) -@with_supported_dtypes( - { - "2.15.0 and below": ( - "float16", - "float32", - "float64", - ) - }, - "tensorflow", -) @to_ivy_arrays_and_back def softplus(features, name=None): return ivy.softplus(features)