From a5ed8164a2be69da3256d7dab585a430b8b94622 Mon Sep 17 00:00:00 2001 From: Deeptendu Santra <55111154+Dsantra92@users.noreply.github.com> Date: Wed, 22 Feb 2023 18:11:43 +0530 Subject: [PATCH] Remove unsupported_dtypes (#10745) --- .../backends/tensorflow/linear_algebra.py | 14 ---- .../torch/experimental/elementwise.py | 5 +- ivy/functional/frontends/tensorflow/nn.py | 65 ++++++++++--------- 3 files changed, 40 insertions(+), 44 deletions(-) diff --git a/ivy/functional/backends/tensorflow/linear_algebra.py b/ivy/functional/backends/tensorflow/linear_algebra.py index e82b4c74ef2c0..68fd7e39e61af 100644 --- a/ivy/functional/backends/tensorflow/linear_algebra.py +++ b/ivy/functional/backends/tensorflow/linear_algebra.py @@ -796,17 +796,3 @@ def vector_to_skew_symmetric_matrix( # BS x 3 x 3 ret = tf.concat((row1, row2, row3), -2) return ret - - -vector_to_skew_symmetric_matrix.unsupported_dtypes = ( - "int8", - "int16", - "int32", - "int64", - "uint8", - "uint16", - "uint32", - "uint64", - "float16", - "float64", -) diff --git a/ivy/functional/backends/torch/experimental/elementwise.py b/ivy/functional/backends/torch/experimental/elementwise.py index b9d8b07510392..4fdfb292831c4 100644 --- a/ivy/functional/backends/torch/experimental/elementwise.py +++ b/ivy/functional/backends/torch/experimental/elementwise.py @@ -27,6 +27,10 @@ def lcm( lcm.support_native_out = True +@with_unsupported_dtypes( + {"2.9.1 and below": ("bfloat16",)}, + backend_version, +) def fmod( x1: torch.Tensor, x2: torch.Tensor, @@ -39,7 +43,6 @@ def fmod( fmod.support_native_out = True -fmod.unsupported_dtypes = ("bfloat16",) def fmax( diff --git a/ivy/functional/frontends/tensorflow/nn.py b/ivy/functional/frontends/tensorflow/nn.py index c20294b08b0aa..d06e5c8dc5bd1 100644 --- a/ivy/functional/frontends/tensorflow/nn.py +++ b/ivy/functional/frontends/tensorflow/nn.py @@ -138,6 +138,7 @@ def conv3d_transpose( ) +@with_unsupported_dtypes({"2.9.1 and below": ("bfloat16",)}, "tensorflow") @to_ivy_arrays_and_back def depthwise_conv2d( input, @@ -164,9 +165,6 @@ def depthwise_conv2d( ) -depthwise_conv2d.unsupported_dtypes = ("bfloat16",) - - @to_ivy_arrays_and_back def batch_normalization(x, mean, variance, offset, scale, variance_epsilon, name=None): inv = 1.0 / ivy.sqrt(variance + variance_epsilon) @@ -183,22 +181,37 @@ def dropout(x, rate, noise_shape=None, seed=None, name=None): return ivy.dropout(x, rate, noise_shape=noise_shape, seed=seed) +@with_unsupported_dtypes( + { + "2.9.1": ( + "int8", + "int16", + "int32", + "int64", + "bool", + "bfloat16", + ) + }, + "tensorflow", +) @to_ivy_arrays_and_back def silu(features, beta: float = 1.0): beta = ivy.astype(ivy.array(beta), ivy.dtype(features)) return ivy.multiply(features, ivy.sigmoid(ivy.multiply(beta, features))) -silu.unsupported_dtypes = ( - "int8", - "int16", - "int32", - "int64", - "bool", - "bfloat16", +@with_unsupported_dtypes( + { + "2.9.1": ( + "int8", + "int16", + "int32", + "int64", + "bool", + ) + }, + "tensorflow", ) - - @to_ivy_arrays_and_back def sigmoid_cross_entropy_with_logits(labels=None, logits=None, name=None): ivy.utils.assertions.check_shape(labels, logits) @@ -210,15 +223,18 @@ def sigmoid_cross_entropy_with_logits(labels=None, logits=None, name=None): return ivy.add(ret_val, ivy.log1p(ivy.exp(neg_abs_logits))) -sigmoid_cross_entropy_with_logits.unsupported_dtypes = ( - "int8", - "int16", - "int32", - "int64", - "bool", +@with_unsupported_dtypes( + { + "2.9.1": ( + "int8", + "int16", + "int32", + "int64", + "bool", + ) + }, + "tensorflow", ) - - @to_ivy_arrays_and_back def weighted_cross_entropy_with_logits( labels=None, logits=None, pos_weight=1.0, name=None @@ -239,15 +255,6 @@ def weighted_cross_entropy_with_logits( return ivy.add(first_term, second_term) -weighted_cross_entropy_with_logits.unsupported_dtypes = ( - "int8", - "int16", - "int32", - "int64", - "bool", -) - - @with_supported_dtypes( {"2.9.0 and below": ("float32", "float16", "bfloat16")}, "tensorflow" )