Repository: ivy-llc/ivy

Issue:
Fix layers.test_fft
|   |   |
|---|---|
|torch|<a href="https://github.com/unifyai/ivy/actions/runs/5641602148/job/15279914794"><img src=https://img.shields.io/badge/-success-success></a>
|jax|<a href="https://github.com/unifyai/ivy/actions/runs/5641602148/job/15279914794"><img src=https://img.shields.io/badge/-success-success></a>
|numpy|<a href="https://github.com/unifyai/ivy/actions/runs/5641602148/job/15279914794"><img src=https://img.shields.io/badge/-success-success></a>
|tensorflow|<a href="https://github.com/unifyai/ivy/actions/runs/5641602148/job/15279914794"><img src=https://img.shields.io/badge/-failure-red></a>
|paddle|<a href="https://github.com/unifyai/ivy/actions/runs/5641602148/job/15279914794"><img src=https://img.shields.io/badge/-success-success></a>



Discussion:

Resolving patch:
diff --git a/ivy/data_classes/container/experimental/layers.py b/ivy/data_classes/container/experimental/layers.py
--- a/ivy/data_classes/container/experimental/layers.py
+++ b/ivy/data_classes/container/experimental/layers.py
@@ -1032,19 +1032,19 @@ def dct(
         )
 
     @staticmethod
-    def static_fft(
-        x: ivy.Container,
+    def _static_fft(
+        x: Union[ivy.Container, ivy.Array, ivy.NativeArray],
         dim: int,
         /,
         *,
         norm: str = "backward",
         n: Optional[Union[int, Tuple[int]]] = None,
+        out: Optional[ivy.Container] = None,
         key_chains: Optional[Union[List[str], Dict[str, str]]] = None,
         to_apply: bool = True,
         prune_unapplied: bool = False,
         map_sequences: bool = False,
-        out: Optional[ivy.Container] = None,
-    ):
+    ) -> ivy.Container:
         """
         ivy.Container static method variant of ivy.fft. This method simply wraps the
         function, and so the docstring for ivy.fft also applies to this method with
@@ -1097,11 +1097,11 @@ def static_fft(
             dim,
             norm=norm,
             n=n,
+            out=out,
             key_chains=key_chains,
             to_apply=to_apply,
             prune_unapplied=prune_unapplied,
             map_sequences=map_sequences,
-            out=out,
         )
 
     def fft(
@@ -1112,7 +1112,11 @@ def fft(
         norm: str = "backward",
         n: Optional[Union[int, Tuple[int]]] = None,
         out: Optional[ivy.Array] = None,
-    ):
+        key_chains: Optional[Union[List[str], Dict[str, str]]] = None,
+        to_apply: bool = True,
+        prune_unapplied: bool = False,
+        map_sequences: bool = False,
+    ) -> ivy.Container:
         """
         ivy.Container instance method variant of ivy.fft. This method simply wraps the
         function, and so the docstring for ivy.fft also applies to this method with
@@ -1159,12 +1163,16 @@ def fft(
                        1.14423775e-17+1.22464680e-16j, 0.00000000e+00+1.22464680e-16j])
         }
         """
-        return self.static_fft(
+        return self._static_fft(
             self,
             dim,
             norm=norm,
             n=n,
             out=out,
+            key_chains=key_chains,
+            to_apply=to_apply,
+            prune_unapplied=prune_unapplied,
+            map_sequences=map_sequences,
         )
 
     @staticmethod
diff --git a/ivy/functional/backends/tensorflow/experimental/layers.py b/ivy/functional/backends/tensorflow/experimental/layers.py
--- a/ivy/functional/backends/tensorflow/experimental/layers.py
+++ b/ivy/functional/backends/tensorflow/experimental/layers.py
@@ -551,7 +551,7 @@ def fft(
         permute[dim], permute[-1] = permute[-1], permute[dim]
         x = tf.transpose(x, permute)
         ret = tf.signal.fft(x, operation_name)
-        x = tf.transpose(x, permute)
+        ret = tf.transpose(ret, permute)
         del permute
     else:
         ret = tf.signal.fft(x, operation_name)
diff --git a/ivy/functional/ivy/experimental/layers.py b/ivy/functional/ivy/experimental/layers.py
--- a/ivy/functional/ivy/experimental/layers.py
+++ b/ivy/functional/ivy/experimental/layers.py
@@ -584,6 +584,7 @@ def dct(
 
 
 @handle_exceptions
+@handle_nestable
 @handle_array_like_without_promotion
 @handle_out_argument
 @to_native_arrays_and_back


Test patch:
diff --git a/ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_layers.py b/ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_layers.py
--- a/ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_layers.py
+++ b/ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_layers.py
@@ -440,8 +440,12 @@ def x_and_fft(draw):
         helpers.array_values(
             dtype=dtype[0],
             shape=tuple(x_dim),
-            large_abs_safety_factor=2,
-            small_abs_safety_factor=2,
+            min_value=-1e5,
+            max_value=1e5,
+            allow_inf=False,
+            large_abs_safety_factor=2.5,
+            small_abs_safety_factor=2.5,
+            safety_factor_scale="log",
         )
     )
     dim = draw(helpers.get_axis(shape=x_dim, allow_neg=True, force_int=True))
@@ -472,6 +476,8 @@ def test_fft(
         test_flags=test_flags,
         fw=backend_fw,
         fn_name=fn_name,
+        rtol_=1e-2,
+        atol_=1e-2,
         on_device=on_device,
         x=x,
         dim=dim,