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

Issue:
maximum



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
@@ -765,6 +765,22 @@ def long(self, memory_format=None):
     def max(self, dim=None, keepdim=False):
         return torch_frontend.max(self, dim=dim, keepdim=keepdim)
 
+    @with_unsupported_dtypes(
+        {
+            "2.0.1 and below": (
+                "complex",
+                "bfloat16",
+                "bool",
+                "uint16",
+                "uint32",
+                "uint64",
+            )
+        },
+        "torch",
+    )
+    def maximum(self, other, *, out=None):
+        return torch_frontend.maximum(self, other=other, out=out)
+
     @property
     def is_quantized(self):
         return "q" in ivy.dtype(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
@@ -8662,6 +8662,44 @@ def test_torch_tensor_max(
     )
 
 
+# maximum
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="maximum",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("valid"),
+        num_arrays=2,
+    ),
+)
+def test_torch_tensor_maximum(
+    dtype_and_x,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    frontend,
+    on_device,
+    backend_fw,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtype,
+        backend_to_test=backend_fw,
+        init_all_as_kwargs_np={
+            "data": x[0],
+        },
+        method_input_dtypes=input_dtype,
+        method_all_as_kwargs_np={
+            "other": x[1],
+        },
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
+
+
 # mean
 @handle_frontend_method(
     class_tree=CLASS_TREE,
Repository: ivy-llc/ivy

Issue:
hfft
Adding hfft to the paddle frontend.


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
@@ -84,6 +84,28 @@ def ifftshift(x, axes=None, name=None):
     return roll
 
 
+@with_supported_dtypes(
+    {"2.5.1 and below": ("complex64", "complex128")},
+    "paddle",
+)
+@to_ivy_arrays_and_back
+def hfft(x, n=None, axis=-1, norm="backward", name=None):
+    """Compute the FFT of a signal that has Hermitian symmetry, resulting in a real
+    spectrum."""
+    # Determine the input shape and axis length
+    input_shape = x.shape
+    input_len = input_shape[axis]
+
+    # Calculate n if not provided
+    if n is None:
+        n = 2 * (input_len - 1)
+
+    # Perform the FFT along the specified axis
+    result = ivy.fft(x, axis, n=n, norm=norm)
+
+    return ivy.real(result)
+
+
 @with_supported_dtypes(
     {"2.5.1 and below": ("complex64", "complex128")},
     "paddle",
@@ -100,3 +122,4 @@ def irfft(x, n=None, axis=-1.0, norm="backward", name=None):
     if ivy.isreal(x):
         time_domain = ivy.real(time_domain)
     return time_domain
+


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_fft.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_fft.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_fft.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_fft.py
@@ -74,6 +74,39 @@ def test_paddle_fftshift(
     )
 
 
+@handle_frontend_test(
+    fn_tree="paddle.fft.hfft",
+    dtype_x_axis=helpers.dtype_values_axis(
+        available_dtypes=helpers.get_dtypes("complex"),
+        min_value=-10,
+        max_value=10,
+        min_num_dims=1,
+        valid_axis=True,
+        force_int_axis=True,
+    ),
+)
+def test_paddle_hfft(
+    dtype_x_axis,
+    frontend,
+    test_flags,
+    fn_tree,
+    on_device,
+    backend_fw,
+):
+    input_dtype, x, axes = dtype_x_axis
+    helpers.test_frontend_function(
+        input_dtypes=input_dtype,
+        backend_to_test=backend_fw,
+        frontend=frontend,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        on_device=on_device,
+        test_values=True,
+        x=x[0],
+        axes=axes,
+    )
+
+
 @handle_frontend_test(
     fn_tree="paddle.fft.ifft",
     dtype_x_axis=helpers.dtype_values_axis(
Repository: ivy-llc/ivy

Issue:
xlogy_
Todo list: #3612


Discussion:
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
working on it.


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
@@ -1878,6 +1878,14 @@ def index_fill(self, dim, index, value):
     def cummax(self, dim):
         return torch_frontend.cummax(self, dim)
 
+    @with_unsupported_dtypes(
+        {"2.0.1 and below": ("bfloat16",)},
+        "torch",
+    )
+    def xlogy_(self, *, other, out=None):
+        self.ivy_array = torch_frontend.xlogy(self, other, out=out).ivy_array
+        return self
+
     def ne(self, other):
         return torch_frontend.ne(self, other)
 


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
@@ -12540,6 +12540,48 @@ def test_torch_tensor_where(
     )
 
 
+# xlogy_
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="xlogy_",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+        num_arrays=2,
+        min_num_dims=1,
+        min_value=-100,
+        max_value=100,
+        shared_dtype=True,
+    ),
+)
+def test_torch_tensor_xlogy_(
+    dtype_and_x,
+    frontend,
+    backend_fw,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    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={
+            "other": x[1],
+        },
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        backend_to_test=backend_fw,
+        on_device=on_device,
+    )
+
+
 # zero_ tests
 @handle_frontend_method(
     class_tree=CLASS_TREE,
Repository: ivy-llc/ivy

Issue:
reciprocal_



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
@@ -404,6 +404,12 @@ def reciprocal(x, name=None):
     return ivy.reciprocal(x)
 
 
+@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle")
+@to_ivy_arrays_and_back
+def reciprocal_(x, name=None):
+    return ivy.inplace_update(x, reciprocal(x))
+
+
 @with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle")
 @to_ivy_arrays_and_back
 def remainder(x, y, name=None):


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
@@ -1743,6 +1743,34 @@ def test_paddle_reciprocal(
     )
 
 
+# reciprocal_
+@handle_frontend_test(
+    fn_tree="paddle.tensor.math.reciprocal_",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+    ),
+)
+def test_paddle_reciprocal_(
+    *,
+    dtype_and_x,
+    on_device,
+    fn_tree,
+    frontend,
+    backend_fw,
+    test_flags,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_function(
+        input_dtypes=input_dtype,
+        frontend=frontend,
+        backend_to_test=backend_fw,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        on_device=on_device,
+        x=x[0],
+    )
+
+
 # remainder
 @handle_frontend_test(
     fn_tree="paddle.remainder",
Repository: ivy-llc/ivy

Issue:
unique
<-- Todo list: #3612


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
@@ -1893,6 +1893,26 @@ def cummax(self, dim):
     def ne(self, other):
         return self.not_equal(other)
 
+    @with_unsupported_dtypes(
+        {
+            "2.0.1 and below": (
+                "bfloat16",
+                "int8",
+                "uint8",
+                "uint32",
+                "uint16",
+                "uint64",
+                "int16",
+                "float16",
+                "complex128",
+                "complex64",
+            )
+        },
+        "torch",
+    )
+    def unique(self, sorted=True, return_inverse=False, return_counts=False, dim=None):
+        return torch_frontend.unique(self, sorted, return_inverse, return_counts, dim)
+
 
 class Size(tuple):
     def __new__(cls, iterable=()):


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
@@ -12652,3 +12652,49 @@ def test_torch_triu_(
         frontend=frontend,
         on_device=on_device,
     )
+
+
+# unique
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="unique",
+    dtype_x_axis=helpers.dtype_values_axis(
+        available_dtypes=helpers.get_dtypes("valid"),
+        valid_axis=True,
+        force_int_axis=True,
+    ),
+    sorted=st.booleans(),
+    return_inverse=st.booleans(),
+    return_counts=st.booleans(),
+)
+def test_torch_unique(
+    dtype_x_axis,
+    sorted,
+    return_inverse,
+    return_counts,
+    frontend,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    on_device,
+    backend_fw,
+):
+    input_dtype, x, axis = dtype_x_axis
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtype,
+        backend_to_test=backend_fw,
+        init_all_as_kwargs_np={"data": x[0]},
+        method_input_dtypes=input_dtype,
+        method_all_as_kwargs_np={
+            "sorted": sorted,
+            "return_inverse": return_inverse,
+            "return_counts": return_counts,
+            "dim": axis,
+        },
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
Repository: ivy-llc/ivy

Issue:
inverse
Sub-Task of #792 


Discussion:

Resolving patch:
diff --git a/ivy/data_classes/array/linear_algebra.py b/ivy/data_classes/array/linear_algebra.py
--- a/ivy/data_classes/array/linear_algebra.py
+++ b/ivy/data_classes/array/linear_algebra.py
@@ -418,7 +418,11 @@ def inner(
         return ivy.inner(self._data, x2, out=out)
 
     def inv(
-        self: ivy.Array, /, *, adjoint: bool = False, out: Optional[ivy.Array] = None
+        self: ivy.Array,
+        /,
+        *,
+        adjoint: bool = False,
+        out: Optional[ivy.Array] = None
     ) -> ivy.Array:
         """
         ivy.Array instance method variant of ivy.inv. This method simply wraps the


Test patch:
Repository: ivy-llc/ivy

Issue:
exp_



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
@@ -184,6 +184,12 @@ def exp(x, name=None):
     return ivy.exp(x)
 
 
+@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle")
+@to_ivy_arrays_and_back
+def exp_(x, name=None):
+    return ivy.inplace_update(x, exp(x))
+
+
 @with_supported_dtypes({"2.5.1 and below": ("float16", "float32", "float64")}, "paddle")
 @to_ivy_arrays_and_back
 def expm1(x, name=None):


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
@@ -790,6 +790,34 @@ def test_paddle_exp(
     )
 
 
+# exp_
+@handle_frontend_test(
+    fn_tree="paddle.tensor.math.exp_",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("valid"),
+    ),
+)
+def test_paddle_exp_(
+    *,
+    dtype_and_x,
+    on_device,
+    fn_tree,
+    frontend,
+    backend_fw,
+    test_flags,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_function(
+        input_dtypes=input_dtype,
+        frontend=frontend,
+        backend_to_test=backend_fw,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        on_device=on_device,
+        x=x[0],
+    )
+
+
 # expm1
 @handle_frontend_test(
     fn_tree="paddle.expm1",
Repository: ivy-llc/ivy

Issue:
unique_consecutive
<-- #3612


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
@@ -1893,6 +1893,29 @@ def index_fill(self, dim, index, value):
         arr = torch_frontend.moveaxis(self, 0, dim)
         return arr
 
+    @with_unsupported_dtypes(
+        {
+            "2.0.1 and below": (
+                "bfloat16",
+                "int8",
+                "uint8",
+                "uint32",
+                "uint16",
+                "uint64",
+                "int16",
+                "float16",
+                "complex128",
+                "complex64",
+                "bool",
+            )
+        },
+        "torch",
+    )
+    def unique_consecutive(self, return_inverse, return_counts, dim):
+        return torch_frontend.unique_consecutive(
+            self, return_inverse, return_counts, dim
+        )
+
     @with_unsupported_dtypes(
         {
             "2.0.1 and below": (


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
@@ -12816,3 +12816,48 @@ def test_torch_unique(
         frontend=frontend,
         on_device=on_device,
     )
+
+
+# unique_consecutive
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="unique_consecutive",
+    dtype_x_axis=helpers.dtype_values_axis(
+        available_dtypes=helpers.get_dtypes("valid"),
+        min_num_dims=2,
+        min_dim_size=2,
+        force_int_axis=True,
+        valid_axis=True,
+    ),
+    return_inverse=st.booleans(),
+    return_counts=st.booleans(),
+)
+def test_torch_unique_consecutive(
+    dtype_x_axis,
+    return_inverse,
+    return_counts,
+    frontend,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    on_device,
+    backend_fw,
+):
+    input_dtype, x, axis = dtype_x_axis
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtype,
+        backend_to_test=backend_fw,
+        init_all_as_kwargs_np={"data": x[0]},
+        method_input_dtypes=input_dtype,
+        method_all_as_kwargs_np={
+            "return_inverse": return_inverse,
+            "return_counts": return_counts,
+            "dim": axis,
+        },
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
Repository: ivy-llc/ivy

Issue:
lerp_
<-- #15039
Closes #21935


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
@@ -288,6 +288,12 @@ def lerp(x, y, weight, name=None):
     return ivy.lerp(x, y, weight)
 
 
+@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle")
+@to_ivy_arrays_and_back
+def lerp_(x, y, weight, name=None):
+    return ivy.inplace_update(x, lerp(x, y, weight))
+
+
 @with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle")
 @to_ivy_arrays_and_back
 def lgamma(x, name=None):


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_math.py
@@ -1222,6 +1222,42 @@ def test_paddle_lerp(
     )
 
 
+# lerp_
+@handle_frontend_test(
+    fn_tree="paddle.tensor.math.lerp_",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+        num_arrays=3,
+        allow_inf=False,
+        large_abs_safety_factor=2,
+        small_abs_safety_factor=2,
+        safety_factor_scale="log",
+        shared_dtype=True,
+    ),
+)
+def test_paddle_lerp_(
+    *,
+    dtype_and_x,
+    on_device,
+    fn_tree,
+    frontend,
+    backend_fw,
+    test_flags,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_function(
+        input_dtypes=input_dtype,
+        frontend=frontend,
+        backend_to_test=backend_fw,
+        fn_tree=fn_tree,
+        test_flags=test_flags,
+        on_device=on_device,
+        x=x[0],
+        y=x[1],
+        weight=x[2],
+    )
+
+
 # lgamma
 @handle_frontend_test(
     fn_tree="paddle.tensor.math.lgamma",
Repository: ivy-llc/ivy

Issue:
as_float_array



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/sklearn/utils/__init__.py b/ivy/functional/frontends/sklearn/utils/__init__.py
--- a/ivy/functional/frontends/sklearn/utils/__init__.py
+++ b/ivy/functional/frontends/sklearn/utils/__init__.py
@@ -1,2 +1,4 @@
 from . import multiclass
 from .multiclass import *
+from . import validation
+from .validation import *
diff --git a/ivy/functional/frontends/sklearn/utils/validation.py b/ivy/functional/frontends/sklearn/utils/validation.py
new file mode 100644
--- /dev/null
+++ b/ivy/functional/frontends/sklearn/utils/validation.py
@@ -0,0 +1,13 @@
+import ivy
+from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back
+
+
+@to_ivy_arrays_and_back
+def as_float_array(X, *, copy=True, force_all_finite=True):
+    if X.dtype in [ivy.float32, ivy.float64]:
+        return X.copy_array() if copy else X
+    if ("bool" in X.dtype or "int" in X.dtype or "uint" in X.dtype) and ivy.itemsize(X) <= 4:
+        return_dtype = ivy.float32
+    else:
+        return_dtype = ivy.float64
+    return ivy.asarray(X, dtype=return_dtype)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_sklearn/test_utils/test_validation.py b/ivy_tests/test_ivy/test_frontends/test_sklearn/test_utils/test_validation.py
new file mode 100644
--- /dev/null
+++ b/ivy_tests/test_ivy/test_frontends/test_sklearn/test_utils/test_validation.py
@@ -0,0 +1,28 @@
+import ivy_tests.test_ivy.helpers as helpers
+from ivy_tests.test_ivy.helpers import handle_frontend_test
+
+
+@handle_frontend_test(
+    fn_tree="sklearn.utils.as_float_array",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("valid"),
+    ),
+)
+def test_sklearn_as_float_array(
+    dtype_and_x,
+    on_device,
+    fn_tree,
+    frontend,
+    test_flags,
+    backend_fw,
+):
+    dtypes, x = dtype_and_x
+    helpers.test_frontend_function(
+        input_dtypes=dtypes,
+        backend_to_test=backend_fw,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        frontend=frontend,
+        on_device=on_device,
+        X=x[0],
+    )
\ No newline at end of file
Repository: ivy-llc/ivy

Issue:
lstsq



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/jax/numpy/linalg.py b/ivy/functional/frontends/jax/numpy/linalg.py
--- a/ivy/functional/frontends/jax/numpy/linalg.py
+++ b/ivy/functional/frontends/jax/numpy/linalg.py
@@ -4,6 +4,7 @@
 from ivy.functional.frontends.jax.func_wrapper import to_ivy_arrays_and_back
 from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
 from ivy.functional.frontends.jax.numpy import promote_types_of_jax_inputs
+from ivy.functional.frontends.numpy.linalg import lstsq as numpy_lstsq
 
 
 @to_ivy_arrays_and_back
@@ -53,6 +54,23 @@ def inv(a):
     return ivy.inv(a)
 
 
+# TODO: replace this with function from API
+# As the composition provides numerically unstable results
+@to_ivy_arrays_and_back
+def lstsq(a, b, rcond=None, *, numpy_resid=False):
+    if numpy_resid:
+        return numpy_lstsq(a, b, rcond=rcond)
+    least_squares_solution = ivy.matmul(
+        ivy.pinv(a, rtol=1e-15).astype(ivy.float64), b.astype(ivy.float64)
+    )
+    residuals = ivy.sum((b - ivy.matmul(a, least_squares_solution)) ** 2).astype(
+        ivy.float64
+    )
+    svd_values = ivy.svd(a, compute_uv=False)
+    rank = ivy.matrix_rank(a).astype(ivy.int32)
+    return (least_squares_solution, residuals, rank, svd_values[0])
+
+
 @to_ivy_arrays_and_back
 def matrix_power(a, n):
     return ivy.matrix_power(a, n)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_linalg.py b/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_linalg.py
--- a/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_linalg.py
+++ b/ivy_tests/test_ivy/test_frontends/test_jax/test_numpy/test_linalg.py
@@ -500,6 +500,40 @@ def test_jax_inv(
     )
 
 
+# least squares
+@handle_frontend_test(
+    fn_tree="jax.numpy.linalg.lstsq",
+    dtype_and_a=helpers.get_first_solve_matrix(adjoint=True),
+    dtype_and_b=helpers.get_second_solve_matrix(),
+    test_with_out=st.just(False),
+)
+def test_jax_lstsq(
+    *,
+    dtype_and_a,
+    dtype_and_b,
+    on_device,
+    fn_tree,
+    frontend,
+    test_flags,
+    backend_fw,
+):
+    a_dtype, a, _ = dtype_and_a
+    b_dtype, b = dtype_and_b
+    helpers.test_frontend_function(
+        input_dtypes=[a_dtype, b_dtype],
+        rtol=1e-01,
+        atol=1e-01,
+        frontend=frontend,
+        test_flags=test_flags,
+        backend_to_test=backend_fw,
+        fn_tree=fn_tree,
+        on_device=on_device,
+        a=a,
+        b=b,
+        test_values=False,
+    )
+
+
 # matrix_power
 @handle_frontend_test(
     fn_tree="jax.numpy.linalg.matrix_power",