internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ivy-llc/ivy

Issue:
argmax



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/tensor/search.py b/ivy/functional/frontends/paddle/tensor/search.py
--- a/ivy/functional/frontends/paddle/tensor/search.py
+++ b/ivy/functional/frontends/paddle/tensor/search.py
@@ -1 +1,15 @@
 # global
+import ivy
+from ivy.func_wrapper import with_supported_dtypes
+from ivy.functional.frontends.paddle.func_wrapper import (
+    to_ivy_arrays_and_back,
+)
+
+
+@with_supported_dtypes(
+    {"2.4.2 and below": ("float32", "float64", "int16", "int32", "int64", "uint8")},
+    "paddle",
+)
+@to_ivy_arrays_and_back
+def argmax(x, /, *, axis=None, keepdim=False, dtype="int64", name=None):
+    return ivy.argmax(x, axis=axis, keepdims=keepdim, dtype=dtype)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_search.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_search.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_search.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_search.py
@@ -1,3 +1,37 @@
 # global
+from hypothesis import strategies as st
 
 # local
+import ivy_tests.test_ivy.helpers as helpers
+from ivy_tests.test_ivy.helpers import handle_frontend_test
+
+
+@handle_frontend_test(
+    fn_tree="paddle.argmax",
+    dtype_x_and_axis=helpers.dtype_values_axis(
+        available_dtypes=helpers.get_dtypes("valid"),
+        min_num_dims=1,
+        valid_axis=True,
+        force_int_axis=True,
+    ),
+    keepdim=st.booleans(),
+)
+def test_paddle_argmax(
+    dtype_x_and_axis,
+    keepdim,
+    frontend,
+    test_flags,
+    fn_tree,
+):
+    # Skipped dtype test due to paddle functions only accepting str and np.ndarray,
+    # but test_frontend_function changes dtype kwargs to native dtype
+    input_dtypes, x, axis = dtype_x_and_axis
+    helpers.test_frontend_function(
+        input_dtypes=input_dtypes,
+        frontend=frontend,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        x=x[0],
+        axis=axis,
+        keepdim=keepdim,
+    )
Repository: ivy-llc/ivy

Issue:
erf



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/torch/tensor.py b/ivy/functional/frontends/torch/tensor.py
--- a/ivy/functional/frontends/torch/tensor.py
+++ b/ivy/functional/frontends/torch/tensor.py
@@ -428,6 +428,10 @@ def not_equal(self, other, *, out=None):
     def equal(self, other):
         return torch_frontend.equal(self, other)
 
+    @with_unsupported_dtypes({"2.0.1 and below": ("float16", "complex")}, "torch")
+    def erf(self, *, out=None):
+        return torch_frontend.erf(self, out=out)
+
     def new_zeros(
         self, size, *, dtype=None, device=None, requires_grad=False, layout=None
     ):


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
@@ -9019,6 +9019,39 @@ def test_torch_instance_equal(
     )
 
 
+# erf
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="erf",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+    ),
+)
+def test_torch_instance_erf(
+    dtype_and_x,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    frontend,
+    on_device,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtype,
+        init_all_as_kwargs_np={
+            "data": x[0],
+        },
+        method_input_dtypes=input_dtype,
+        method_all_as_kwargs_np={},
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
+
+
 # greater
 @handle_frontend_method(
     class_tree=CLASS_TREE,
Repository: ivy-llc/ivy

Issue:
band_part



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/tensorflow/linalg.py b/ivy/functional/frontends/tensorflow/linalg.py
--- a/ivy/functional/frontends/tensorflow/linalg.py
+++ b/ivy/functional/frontends/tensorflow/linalg.py
@@ -293,3 +293,14 @@ def diag(
     if (num_cols and num_rows) and (size == (num_cols * num_rows)):
         output = ivy.reshape(output, (num_rows, num_cols))
     return ivy.astype(output, ivy.dtype(diagonal))
+
+
+@to_ivy_arrays_and_back
+def band_part(input, num_lower, num_upper, name=None):
+    m, n = ivy.meshgrid(
+        ivy.arange(input.shape[-2]), ivy.arange(input.shape[-1]), indexing="ij"
+    )
+    mask = ((num_lower < 0) | ((m - n) <= num_lower)) & (
+        (num_upper < 0) | ((n - m) <= num_upper)
+    )
+    return ivy.where(mask, input, ivy.zeros_like(input))


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_linalg.py b/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_linalg.py
--- a/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_linalg.py
+++ b/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_linalg.py
@@ -821,7 +821,9 @@ def test_tensorflow_linalg_einsum(
 # adjoint
 @handle_frontend_test(
     fn_tree="tensorflow.linalg.adjoint",
-    dtype_and_x=_get_dtype_and_matrix(),
+    dtype_and_x=_get_dtype_and_matrix().filter(
+        lambda x: "float16" not in x[0] and "bfloat16" not in x[0]
+    ),  # TODO : remove this filter when paddle.conj supports float16
     test_with_out=st.just(False),
 )
 def test_tensorflow_adjoint(
@@ -875,3 +877,48 @@ def test_tensorflow_diag(
         v=x[0],
         k=k,
     )
+
+
+@st.composite
+def _get_dtype_and_matrix_and_num(draw):
+    arbitrary_dims = draw(helpers.get_shape(max_dim_size=5))
+    random_size = draw(st.integers(min_value=1, max_value=4))
+    shape = (*arbitrary_dims, random_size, random_size)
+    dtype_and_values = draw(
+        helpers.dtype_and_values(
+            available_dtypes=helpers.get_dtypes("float"),
+            shape=shape,
+            min_value=-10,
+            max_value=10,
+        )
+    )
+    num_lower = draw(st.integers(min_value=-1, max_value=random_size - 1))
+    num_upper = draw(st.integers(min_value=-1, max_value=random_size - 1))
+    return (*dtype_and_values, num_lower, num_upper)
+
+
+# band_part
+@handle_frontend_test(
+    fn_tree="tensorflow.linalg.band_part",
+    dtype_and_input=_get_dtype_and_matrix_and_num(),
+    test_with_out=st.just(False),
+)
+def test_tensorflow_band_part(
+    *,
+    dtype_and_input,
+    frontend,
+    test_flags,
+    fn_tree,
+    on_device,
+):
+    input_dtype, x, num_lower, num_upper = dtype_and_input
+    helpers.test_frontend_function(
+        input_dtypes=input_dtype,
+        frontend=frontend,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        on_device=on_device,
+        input=x[0],
+        num_lower=num_lower,
+        num_upper=num_upper,
+    )
Repository: ivy-llc/ivy

Issue:
pareto



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/jax/random.py b/ivy/functional/frontends/jax/random.py
--- a/ivy/functional/frontends/jax/random.py
+++ b/ivy/functional/frontends/jax/random.py
@@ -261,3 +261,25 @@ def weibull_min(key, scale, concentration, shape=(), dtype="float64"):
     x = 1 - uniform_x
     weibull = x ** (concentration - 1) * -ivy.log(x / scale)
     return weibull
+
+
+@handle_jax_dtype
+@to_ivy_arrays_and_back
+@with_unsupported_dtypes(
+    {
+        "0.3.14 and below": (
+            "float16",
+            "bfloat16",
+        )
+    },
+    "jax",
+)
+def pareto(key, b, shape=None, dtype="float64"):
+    seed = _get_seed(key)
+    if shape is None:
+        shape = b.shape
+    # Draw samples from exponential distribution
+    uniform = ivy.random_uniform(seed=seed, shape=shape, dtype=dtype)
+    e = -ivy.log(1 - uniform)
+
+    return ivy.exp(e / b)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_random.py b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_random.py
--- a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_random.py
+++ b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_random.py
@@ -1129,3 +1129,65 @@ def call():
     for u, v in zip(ret_np, ret_from_np):
         assert u.dtype == v.dtype
         assert u.shape == v.shape
+
+
+@st.composite
+def get_shape_and_arrays(draw):
+    b_shapes = draw(
+        helpers.array_and_broadcastable_shape(dtype=helpers.get_dtypes("float"))
+    )
+    b, shapes = b_shapes
+    shapes = draw(st.sampled_from([None, shapes]))
+    return b, shapes
+
+
+@handle_frontend_test(
+    fn_tree="jax.random.pareto",
+    dtype_key=helpers.dtype_and_values(
+        available_dtypes=["uint32"],
+        min_value=0,
+        max_value=2000,
+        min_num_dims=1,
+        max_num_dims=1,
+        min_dim_size=2,
+        max_dim_size=2,
+    ),
+    b_shapes=get_shape_and_arrays(),
+    dtype=helpers.get_dtypes("float", full=False),
+)
+def test_jax_pareto(
+    *,
+    dtype_key,
+    b_shapes,
+    dtype,
+    on_device,
+    fn_tree,
+    frontend,
+    test_flags,
+):
+    input_dtype, key = dtype_key
+    b, shape = b_shapes
+
+    def call():
+        return helpers.test_frontend_function(
+            input_dtypes=input_dtype,
+            frontend=frontend,
+            test_flags=test_flags,
+            fn_tree=fn_tree,
+            on_device=on_device,
+            test_values=False,
+            key=key[0],
+            b=b,
+            shape=shape,
+            dtype=dtype[0],
+        )
+
+    ret = call()
+
+    if not ivy.exists(ret):
+        return
+    ret_np, ret_from_np = ret
+    if shape is not None:
+        assert ret_np.shape == shape
+    else:
+        assert ret_np.shape == b.shape
Repository: ivy-llc/ivy

Issue:
flat



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/numpy/ndarray/ndarray.py b/ivy/functional/frontends/numpy/ndarray/ndarray.py
--- a/ivy/functional/frontends/numpy/ndarray/ndarray.py
+++ b/ivy/functional/frontends/numpy/ndarray/ndarray.py
@@ -57,6 +57,11 @@ def dtype(self):
     def ndim(self):
         return len(self.shape)
 
+    @property
+    def flat(self):
+        self = self.flatten()
+        return self
+
     # Setters #
     # --------#
 


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py b/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py
--- a/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py
+++ b/ivy_tests/test_ivy/test_frontends/test_numpy/test_ndarray/test_ndarray.py
@@ -116,6 +116,25 @@ def test_numpy_ndarray_property_T(
     )
 
 
+@given(
+    dtype_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("numeric", prune_function=False),
+        num_arrays=1,
+        ret_shape=True,
+    )
+)
+def test_numpy_ndarray_property_flat(dtype_x):
+    dtype, data, shape = dtype_x
+
+    x = ndarray(shape, dtype[0])
+    x.ivy_array = data[0]
+
+    flat_ivy = x.flat
+    flat_ivy = flat_ivy.ivy_array.to_numpy()
+    flat_generated = ivy.to_numpy(data[0]).flatten()
+    ivy.utils.assertions.check_equal(flat_ivy, flat_generated, as_array=True)
+
+
 @handle_frontend_method(
     class_tree=CLASS_TREE,
     init_tree="numpy.array",
Repository: ivy-llc/ivy

Issue:
is_quantized



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/torch/tensor.py b/ivy/functional/frontends/torch/tensor.py
--- a/ivy/functional/frontends/torch/tensor.py
+++ b/ivy/functional/frontends/torch/tensor.py
@@ -653,6 +653,9 @@ def long(self, memory_format=None):
     def max(self, dim=None, keepdim=False):
         return torch_frontend.max(self, dim=dim, keepdim=keepdim)
 
+    def is_quantized(self):
+        return "q" in ivy.dtype(self.ivy_array)
+
     def is_cuda(self):
         return "gpu" in ivy.dev(self.ivy_array)
 


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
@@ -3545,6 +3545,39 @@ def test_torch_instance_max(
     )
 
 
+# is_quantized
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="is_quantized",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("qint8"),
+    ),
+)
+def test_torch_instance_is_quantized(
+    dtype_and_x,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    frontend,
+    on_device,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtype,
+        init_all_as_kwargs_np={
+            "data": x[0],
+        },
+        method_input_dtypes=[],
+        method_all_as_kwargs_np={},
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
+
+
 # is_cuda
 @handle_frontend_method(
     class_tree=CLASS_TREE,
Repository: ivy-llc/ivy

Issue:
top_k
Math functions for TensorFlow frontend


Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/tensorflow/math.py b/ivy/functional/frontends/tensorflow/math.py
--- a/ivy/functional/frontends/tensorflow/math.py
+++ b/ivy/functional/frontends/tensorflow/math.py
@@ -703,3 +703,8 @@ def in_top_k(target, pred, k, name=None):
 @to_ivy_arrays_and_back
 def conj(x, name=None):
     return ivy.conj(x)
+
+
+@to_ivy_arrays_and_back
+def top_k(input, k=1, sorted=True, name=None):
+    return ivy.top_k(input, k, sorted=sorted)
\ No newline at end of file


Test patch:
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
--- a/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_math.py
+++ b/ivy_tests/test_ivy/test_frontends/test_tensorflow/test_math.py
@@ -2585,3 +2585,28 @@ def test_tensorflow_conj(
         on_device=on_device,
         x=x[0],
     )
+
+
+# top_k
+@handle_frontend_test(
+    fn_tree="tensorflow.math.top_k",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("numeric"),
+        shared_dtype=True,
+    ),
+    k=st.integers(min_value=0, max_value=5),
+    sorted=st.booleans(),
+    test_with_out=st.just(False),
+)
+def test_tensorflow_top_k(*, dtype_and_x, frontend, test_flags, fn_tree, on_device, k):
+    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,
+        input=x[0],
+        k=k,
+        sorted=sorted
+    )
\ No newline at end of file
Repository: ivy-llc/ivy

Issue:
multiply



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/tensor/tensor.py b/ivy/functional/frontends/paddle/tensor/tensor.py
--- a/ivy/functional/frontends/paddle/tensor/tensor.py
+++ b/ivy/functional/frontends/paddle/tensor/tensor.py
@@ -177,6 +177,10 @@ def square(self, name=None):
     def cholesky(self, upper=False, name=None):
         return ivy.cholesky(self._ivy_array, upper=upper)
 
+    @with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
+    def multiply(self, y, name=None):
+        return paddle_frontend.multiply(self, y)
+
     @with_supported_dtypes(
         {"2.4.2 and below": ("float16", "float32", "float64", "int32", "int64")},
         "paddle",


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_tensor.py
@@ -845,6 +845,42 @@ def test_paddle_cholesky(
     )
 
 
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="paddle.to_tensor",
+    method_name="multiply",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+        num_arrays=2,
+        shared_dtype=True,
+    ),
+)
+def test_paddle_instance_multiply(
+    dtype_and_x,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    frontend,
+    on_device,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtype,
+        init_all_as_kwargs_np={
+            "value": x[0],
+        },
+        method_input_dtypes=input_dtype,
+        method_all_as_kwargs_np={
+            "y": x[1],
+        },
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
+
+
 # all
 @handle_frontend_method(
     class_tree=CLASS_TREE,
Repository: ivy-llc/ivy

Issue:
rad2deg



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/tensor/math.py b/ivy/functional/frontends/paddle/tensor/math.py
--- a/ivy/functional/frontends/paddle/tensor/math.py
+++ b/ivy/functional/frontends/paddle/tensor/math.py
@@ -150,3 +150,9 @@ def log2(x, name=None):
 @to_ivy_arrays_and_back
 def log1p(x, name=None):
     return ivy.log1p(x)
+
+
+@with_unsupported_dtypes({"2.4.2 and below": ("float16", "bfloat16")}, "paddle")
+@to_ivy_arrays_and_back
+def rad2deg(x, name=None):
+    return ivy.rad2deg(x)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py
@@ -669,3 +669,29 @@ def test_paddle_log1p(
         on_device=on_device,
         x=x[0],
     )
+
+
+# rad2deg
+@handle_frontend_test(
+    fn_tree="paddle.rad2deg",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("valid"),
+    ),
+)
+def test_paddle_rad2deg(
+    *,
+    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,
+        x=x[0],
+    )
Repository: ivy-llc/ivy

Issue:
fft



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/fft.py b/ivy/functional/frontends/paddle/fft.py
--- a/ivy/functional/frontends/paddle/fft.py
+++ b/ivy/functional/frontends/paddle/fft.py
@@ -1 +1,16 @@
 # global
+import ivy
+from ivy.func_wrapper import with_supported_dtypes
+from ivy.functional.frontends.paddle.func_wrapper import (
+    to_ivy_arrays_and_back,
+)
+
+
+@with_supported_dtypes(
+    {"2.4.2 and below": ("complex64", "complex128")},
+    "paddle",
+)
+@to_ivy_arrays_and_back
+def fft(x, n=None, axis=-1.0, norm="backward", name=None):
+    ret = ivy.fft(ivy.astype(x, "complex128"), axis, norm=norm, n=n)
+    return ivy.astype(ret, x.dtype)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_paddle_fft.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_paddle_fft.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_paddle_fft.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_paddle_fft.py
@@ -1,3 +1,44 @@
 # global
+from hypothesis import strategies as st
 
 # local
+import ivy_tests.test_ivy.helpers as helpers
+from ivy_tests.test_ivy.helpers import handle_frontend_test
+
+
+@handle_frontend_test(
+    fn_tree="paddle.fft.fft",
+    dtype_x_axis=helpers.dtype_values_axis(
+        available_dtypes=helpers.get_dtypes("valid"),
+        min_value=-10,
+        max_value=10,
+        min_num_dims=1,
+        min_dim_size=2,
+        valid_axis=True,
+        force_int_axis=True,
+    ),
+    n=st.one_of(
+        st.integers(min_value=2, max_value=10),
+        st.just(None),
+    ),
+    norm=st.sampled_from(["backward", "ortho", "forward"]),
+)
+def test_paddle_fft(
+    dtype_x_axis,
+    n,
+    norm,
+    frontend,
+    test_flags,
+    fn_tree,
+):
+    input_dtypes, x, axis = dtype_x_axis
+    helpers.test_frontend_function(
+        input_dtypes=input_dtypes,
+        frontend=frontend,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        x=x[0],
+        n=n,
+        axis=axis,
+        norm=norm,
+    )
Repository: ivy-llc/ivy

Issue:
tanhshrink



Discussion:
- [ ] #16293
This issue has been labelled as stale. If you would like to continue working on this issue, then please add another comment or create a PR . If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. For more information please refer to this page in our documentation: https://lets-unify.ai/ivy/contributing/1_the_basics.html#todo-list-issues

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/nn/functional/activation.py b/ivy/functional/frontends/paddle/nn/functional/activation.py
--- a/ivy/functional/frontends/paddle/nn/functional/activation.py
+++ b/ivy/functional/frontends/paddle/nn/functional/activation.py
@@ -131,3 +131,14 @@ def celu(
     prod = alpha * (ivy.exp(x / alpha) - 1)
     ret = ivy.maximum(0, x) + ivy.minimum(0, prod)
     return ret
+
+
+@with_supported_dtypes({"2.4.2 and below": ("float32", "float64")}, "paddle")
+@to_ivy_arrays_and_back
+def tanhshrink(
+    x,
+    /,
+    *,
+    name=None,
+):
+    return ivy.subtract(x, ivy.tanh(x))


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_nn/test_functional/test_paddle_activation.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_nn/test_functional/test_paddle_activation.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_nn/test_functional/test_paddle_activation.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_nn/test_functional/test_paddle_activation.py
@@ -381,3 +381,29 @@ def test_paddle_celu(
         x=x[0],
         alpha=alpha,
     )
+
+
+# tanhshrink
+@handle_frontend_test(
+    fn_tree="paddle.nn.functional.tanhshrink",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("valid"),
+    ),
+)
+def test_paddle_tanhshrink(
+    *,
+    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,
+        x=x[0],
+    )