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

Issue:
 __irshift__



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
@@ -637,6 +637,9 @@ def var(
             where=where,
         )
 
+    def __irshift__(self, value, /):
+        return ivy.bitwise_right_shift(self.ivy_array, value, out=self)
+
 
 # --- Helpers --- #
 # --------------- #


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
@@ -1077,6 +1077,56 @@ def test_numpy___ipow__(
     )
 
 
+# __irshift__
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="numpy.array",
+    method_name="__irshift__",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("integer"),
+        num_arrays=2,
+    ),
+)
+def test_numpy___irshift__(
+    dtype_and_x,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    frontend,
+    backend_fw,
+    on_device,
+):
+    input_dtypes, x = dtype_and_x
+    max_bits = np.iinfo(input_dtypes[0]).bits
+    max_shift = max_bits - 1
+    x[1] = np.asarray(np.clip(x[1], 0, max_shift), dtype=input_dtypes[1])
+    max_value_before_shift = 2 ** (max_bits - x[1]) - 1
+    overflow_threshold = 2 ** (max_bits - 1)
+    x[0] = np.asarray(
+        np.clip(x[0], None, max_value_before_shift), dtype=input_dtypes[0]
+    )
+    if np.any(x[0] > overflow_threshold):
+        x[0] = np.clip(x[0], None, overflow_threshold)
+    if np.any(x[0] < 0):
+        x[0] = np.abs(x[0])
+    helpers.test_frontend_method(
+        init_input_dtypes=input_dtypes,
+        init_all_as_kwargs_np={
+            "object": x[0],
+        },
+        method_input_dtypes=input_dtypes,
+        backend_to_test=backend_fw,
+        method_all_as_kwargs_np={
+            "value": x[1],
+        },
+        frontend=frontend,
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        on_device=on_device,
+    )
+
+
 @handle_frontend_method(
     class_tree=CLASS_TREE,
     init_tree="numpy.array",
Repository: ivy-llc/ivy

Issue:
fill_



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
@@ -814,6 +814,13 @@ def cast(self, dtype):
         return paddle_frontend.cast(self, dtype)
 
     @with_supported_dtypes(
+        {"2.5.1 and below": ("float16", "float32", "float64", "int32", "int64")},
+        "paddle",
+    )
+    def fill_(self, value):
+        filled_tensor = paddle_frontend.full_like(self, value)
+        return ivy.inplace_update(self, filled_tensor))
+
         {
             "2.5.1 and below": (
                 "bool",


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py
@@ -1978,6 +1978,50 @@ def test_paddle_tensor_exp_(
     )
 
 
+# fill_
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="paddle.to_tensor",
+    method_name="fill_",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("valid"),
+        allow_inf=False,
+    ),
+    dtype_v=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("valid"),
+        shape=(1,),
+        min_value=0,
+        max_value=10,
+    ),
+)
+def test_paddle_tensor_fill_(
+    dtype_and_x,
+    dtype_v,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    frontend,
+    on_device,
+    backend_fw,
+):
+    input_dtype, x = dtype_and_x
+    value_dtype, v = dtype_v
+    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=value_dtype,
+        method_all_as_kwargs_np={"value": v[0].item()},
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
+
+
 # floor
 @handle_frontend_method(
     class_tree=CLASS_TREE,
Repository: ivy-llc/ivy

Issue:
floor_divide



Discussion:

Resolving patch:
diff --git a/ivy/functional/ivy/elementwise.py b/ivy/functional/ivy/elementwise.py
--- a/ivy/functional/ivy/elementwise.py
+++ b/ivy/functional/ivy/elementwise.py
@@ -2892,7 +2892,21 @@ def floor_divide(
     >>> print(y)
     ivy.array([4., 3., 1.])
 
-    With mixed :class:`ivy.Array` and :class:`ivy.NativeArray` inputs:
+    >>> x1 = ivy.array([13., 7., 8.])
+    >>> x2 = ivy.array([3., 2., 7.])
+    >>> y = ivy.zeros((2, 3))
+    >>> ivy.floor_divide(x1, x2, out=y)
+    >>> print(y)
+    ivy.array([4., 3., 1.])
+
+    >>> x1 = ivy.array([13., 7., 8.])
+    >>> x2 = ivy.array([3., 2., 7.])
+    >>> ivy.floor_divide(x1, x2, out=x1)
+    >>> print(x1)
+    ivy.array([4., 3., 1.])
+
+
+    With a mix of :class:`ivy.Array` and :class:`ivy.NativeArray` inputs:
 
     >>> x1 = ivy.array([3., 4., 5.])
     >>> x2 = ivy.native_array([5., 2., 1.])


Test patch:
Repository: ivy-llc/ivy

Issue:
unset_default_int_dtype



Discussion:

Resolving patch:
diff --git a/ivy/functional/ivy/data_type.py b/ivy/functional/ivy/data_type.py
--- a/ivy/functional/ivy/data_type.py
+++ b/ivy/functional/ivy/data_type.py
@@ -2351,10 +2351,6 @@ def unset_default_int_dtype():
     """
     Reset the current default int dtype to the previous state.
 
-    Parameters
-    ----------
-    None-
-
     Examples
     --------
     >>> ivy.set_default_int_dtype(ivy.intDtype("int16"))


Test patch:
Repository: ivy-llc/ivy

Issue:
cast



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
I see that @Mghrabi solved this issue when i was on vacation, thanks!

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
@@ -776,3 +776,20 @@ def less_equal(self, y, name=None):
     @with_supported_dtypes({"2.5.1 and below": ("complex64", "complex128")}, "paddle")
     def real(self, name=None):
         return paddle_frontend.real(self._ivy_array)
+
+    @with_supported_dtypes(
+        {
+            "2.5.1 and below": (
+                "bool",
+                "float16",
+                "float32",
+                "float64",
+                "int32",
+                "int64",
+                "uint8",
+            )
+        },
+        "paddle",
+    )
+    def cast(self, dtype):
+        return paddle_frontend.cast(self, dtype)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_tensor.py
@@ -1078,6 +1078,47 @@ def test_paddle_tensor_bitwise_xor(
     )
 
 
+# cast
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="paddle.to_tensor",
+    method_name="cast",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("valid"),
+    ),
+    dtype=helpers.get_dtypes("valid", full=False),
+)
+def test_paddle_tensor_cast(
+    dtype_and_x,
+    dtype,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    frontend,
+    on_device,
+    backend_fw,
+):
+    input_dtype, x = dtype_and_x
+    if dtype is None:
+        dtype = input_dtype
+    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={
+            "dtype": dtype[0],
+        },
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
+
+
 # ceil
 @handle_frontend_method(
     class_tree=CLASS_TREE,
Repository: ivy-llc/ivy

Issue:
multinomial



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.

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/random.py b/ivy/functional/frontends/paddle/random.py
--- a/ivy/functional/frontends/paddle/random.py
+++ b/ivy/functional/frontends/paddle/random.py
@@ -7,6 +7,16 @@
 )
 
 
+@with_supported_dtypes(
+    {"2.5.1 and below": ("float32", "float64")},
+    "paddle",
+)
+@to_ivy_arrays_and_back
+def multinomial(x, num_samples=1, replacement=False, name=None):
+    n = num_samples + 1
+    return ivy.multinomial(n, num_samples, probs=x, replace=replacement)
+
+
 @with_supported_dtypes(
     {"2.5.1 and below": ("float32", "float64")},
     "paddle",


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_random.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_random.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_random.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_random.py
@@ -7,6 +7,64 @@
 from ivy_tests.test_ivy.helpers import handle_frontend_test
 
 
+# --- Helpers --- #
+# --------------- #
+
+
+@st.composite
+def _multinomial_helper(draw):
+    input_dtype_and_x = draw(
+        helpers.dtype_and_values(
+            available_dtypes=helpers.get_dtypes("valid"),
+            shape=helpers.get_shape(min_num_dims=1, max_num_dims=2, min_dim_size=2),
+        )
+    )
+    num_samples = draw(st.integers(min_value=1, max_value=10))
+    if num_samples > 2:
+        replacement = True
+    else:
+        replacement = draw(st.booleans())
+
+    input_dtype, x = input_dtype_and_x
+
+    total = sum(x)
+    x = [arr / total for arr in x]
+
+    return input_dtype, x, num_samples, replacement
+
+
+# --- Main --- #
+# ------------ #
+
+
+# multinomial
+@handle_frontend_test(
+    fn_tree="paddle.tensor.random.multinomial",
+    input_dtype_and_x=_multinomial_helper(),
+)
+def test_paddle_multinomial(
+    input_dtype_and_x,
+    test_flags,
+    frontend,
+    backend_fw,
+    fn_tree,
+    on_device,
+):
+    input_dtype, x, num_samples, replacement = input_dtype_and_x
+    helpers.test_frontend_function(
+        input_dtypes=input_dtype,
+        test_flags=test_flags,
+        frontend=frontend,
+        backend_to_test=backend_fw,
+        fn_tree=fn_tree,
+        on_device=on_device,
+        test_values=False,
+        x=x[0],
+        num_samples=num_samples,
+        replacement=replacement,
+    )
+
+
 @handle_frontend_test(
     fn_tree="paddle.normal",
     input_dtypes=st.sampled_from([["float32"], ["float64"]]),
Repository: ivy-llc/ivy

Issue:
chunk



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
@@ -782,6 +782,24 @@ def remainder(self, y, name=None):
     def is_floating_point(self):
         return paddle_frontend.is_floating_point(self._ivy_array)
 
+    @with_supported_dtypes(
+        {
+            "2.5.1 and below": (
+                "bool",
+                "float16",
+                "float32",
+                "float64",
+                "int8",
+                "int16",
+                "int32",
+                "int64",
+            )
+        },
+        "paddle",
+    )
+    def chunk(self, chunks, axis=0, name=None):
+        return paddle_frontend.split(self._ivy_array, num_or_sections=chunks, axis=axis)
+
     @with_unsupported_dtypes(
         {"2.5.1 and below": ("complex", "uint8", "uint16")}, "paddle"
     )


Test patch:
Repository: ivy-llc/ivy

Issue:
nansum



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
@@ -870,6 +870,11 @@ def mean(self, dim=None, keepdim=False):
     def nanmean(self, dim=None, keepdim=False):
         return torch_frontend.nanmean(self, dim=dim, keepdim=keepdim)
 
+    @with_unsupported_dtypes({"2.0.1 and below": ("bfloat16",)}, "torch")
+    @numpy_to_torch_style_args
+    def nansum(self, dim=None, keepdim=False):
+        return torch_frontend.nansum(self, dim=dim, keepdim=keepdim)
+
     @numpy_to_torch_style_args
     @with_unsupported_dtypes({"2.0.1 and below": ("float16",)}, "torch")
     def median(self, dim=None, keepdim=False):


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
@@ -1571,6 +1571,43 @@ def test_torch_index_fill(
     )
 
 
+# nansum
+@handle_frontend_method(
+    class_tree=CLASS_TREE,
+    init_tree="torch.tensor",
+    method_name="nansum",
+    dtype_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("float"),
+        min_value=-1e04,
+        max_value=1e04,
+    ),
+)
+def test_torch_instance_nansum(
+    dtype_x,
+    frontend,
+    frontend_method_data,
+    init_flags,
+    method_flags,
+    on_device,
+    backend_fw,
+):
+    input_dtype, x = dtype_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={},
+        frontend_method_data=frontend_method_data,
+        init_flags=init_flags,
+        method_flags=method_flags,
+        frontend=frontend,
+        on_device=on_device,
+    )
+
+
 # scatter
 @handle_frontend_method(
     class_tree=CLASS_TREE,
Repository: ivy-llc/ivy

Issue:
asanyarray
Hi,

   I would like to work on this issue. Thanks.


Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/numpy/manipulation_routines/changing_array_shape.py b/ivy/functional/frontends/numpy/manipulation_routines/changing_array_shape.py
--- a/ivy/functional/frontends/numpy/manipulation_routines/changing_array_shape.py
+++ b/ivy/functional/frontends/numpy/manipulation_routines/changing_array_shape.py
@@ -5,6 +5,11 @@
 )
 
 
+@to_ivy_arrays_and_back
+def asanyarray(a, dtype=None, order=None, like=None):
+    return ivy.asarray(a)
+
+
 @to_ivy_arrays_and_back
 def asarray_chkfinite(a, dtype=None, order=None):
     a = ivy.asarray(a, dtype=dtype)


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_numpy/test_manipulation_routines/test_changing_array_shape.py b/ivy_tests/test_ivy/test_frontends/test_numpy/test_manipulation_routines/test_changing_array_shape.py
--- a/ivy_tests/test_ivy/test_frontends/test_numpy/test_manipulation_routines/test_changing_array_shape.py
+++ b/ivy_tests/test_ivy/test_frontends/test_numpy/test_manipulation_routines/test_changing_array_shape.py
@@ -56,6 +56,33 @@ def dtypes_x_reshape(draw):
     return dtypes, x, shape
 
 
+# asanyarray
+@handle_frontend_test(
+    fn_tree="numpy.asanyarray",
+    dtype_and_a=helpers.dtype_and_values(available_dtypes=helpers.get_dtypes("float")),
+    test_with_out=st.just(False),
+)
+def test_numpy_asanyarray(
+    *,
+    dtype_and_a,
+    on_device,
+    fn_tree,
+    frontend,
+    test_flags,
+    backend_fw,
+):
+    dtype, a = dtype_and_a
+    helpers.test_frontend_function(
+        input_dtypes=dtype,
+        backend_to_test=backend_fw,
+        frontend=frontend,
+        test_flags=test_flags,
+        fn_tree=fn_tree,
+        on_device=on_device,
+        a=a[0],
+    )
+
+
 # asarray_chkfinite
 @handle_frontend_test(
     fn_tree="numpy.asarray_chkfinite",
Repository: ivy-llc/ivy

Issue:
l1_loss



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/torch/nn/functional/loss_functions.py b/ivy/functional/frontends/torch/nn/functional/loss_functions.py
--- a/ivy/functional/frontends/torch/nn/functional/loss_functions.py
+++ b/ivy/functional/frontends/torch/nn/functional/loss_functions.py
@@ -2,7 +2,7 @@
 import ivy
 import ivy.functional.frontends.torch as torch_frontend
 from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
-from ivy.func_wrapper import with_unsupported_dtypes
+from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
 
 
 # --- Helpers --- #
@@ -334,6 +334,7 @@ def batchmean(x):
 
 
 @to_ivy_arrays_and_back
+@with_supported_dtypes({"2.0.1 and below": ("float", "complex")}, "torch")
 def l1_loss(
     input,
     target,
@@ -341,9 +342,9 @@ def l1_loss(
     reduce=None,
     reduction="mean",
 ):
-    loss = ivy.abs(input - target)
-    reduction = _get_reduction(reduction, size_average, reduce)
-    ret = reduction(loss)
+    if size_average is not None or reduce is not None:
+        reduction = _legacy_get_string(size_average, reduce)
+    ret = ivy.l1_loss(input, target, reduction=reduction)
     return ret
 
 


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_loss_functions.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_loss_functions.py
--- a/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_loss_functions.py
+++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_loss_functions.py
@@ -502,7 +502,7 @@ def test_torch_kl_div(
 @handle_frontend_test(
     fn_tree="torch.nn.functional.l1_loss",
     dtype_and_x=helpers.dtype_and_values(
-        available_dtypes=helpers.get_dtypes("float"),
+        available_dtypes=helpers.get_dtypes("valid"),
         num_arrays=2,
         allow_inf=False,
         shared_dtype=True,
Repository: ivy-llc/ivy

Issue:
huber_loss



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/torch/nn/functional/loss_functions.py b/ivy/functional/frontends/torch/nn/functional/loss_functions.py
--- a/ivy/functional/frontends/torch/nn/functional/loss_functions.py
+++ b/ivy/functional/frontends/torch/nn/functional/loss_functions.py
@@ -284,19 +284,7 @@ def huber_loss(
     reduction="mean",
     delta=1.0,
 ):
-    delta = ivy.array(delta)
-    _diff_abs = ivy.abs(ivy.subtract(input, target))
-
-    loss = ivy.where(
-        _diff_abs < delta,  # If |xᵢ - yᵢ| < δ
-        0.5 * _diff_abs**2,  # lᵢ = 0.5(xᵢ - yᵢ)²
-        delta * (_diff_abs - 0.5 * delta),
-    )  # lᵢ = δ(|xᵢ - yᵢ| - 0.5 * δ)
-
-    reduction = _get_reduction(reduction)
-    ret = reduction(loss)
-
-    return ivy.astype(ret, input.dtype)
+    return ivy.huber_loss(target, input, delta=delta, reduction=reduction)
 
 
 @to_ivy_arrays_and_back


Test patch:
Repository: ivy-llc/ivy

Issue:
tpu_is_available



Discussion:

Resolving patch:
diff --git a/ivy/functional/ivy/device.py b/ivy/functional/ivy/device.py
--- a/ivy/functional/ivy/device.py
+++ b/ivy/functional/ivy/device.py
@@ -755,8 +755,9 @@ def tpu_is_available() -> bool:
 
     Examples
     --------
+    >>> ivy.set_backend("torch")
     >>> print(ivy.tpu_is_available())
-    False
+    True
     """
     return ivy.current_backend().tpu_is_available()
 


Test patch:
Repository: ivy-llc/ivy

Issue:
kthvalue



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/search.py b/ivy/functional/frontends/paddle/search.py
--- a/ivy/functional/frontends/paddle/search.py
+++ b/ivy/functional/frontends/paddle/search.py
@@ -33,6 +33,28 @@ def argsort(x, /, *, axis=-1, descending=False, name=None):
     return ivy.argsort(x, axis=axis, descending=descending)
 
 
+# kthvalue
+@with_supported_dtypes(
+    {"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle"
+)
+@to_ivy_arrays_and_back
+def kthvalue(x, k, axis=None, keepdim=False, name=None):
+    if axis is None:
+        axis = -1
+    sorted_input = ivy.sort(x, axis=axis)
+    sort_indices = ivy.argsort(x, axis=axis)
+
+    values = ivy.gather(sorted_input, ivy.array(k - 1), axis=axis)
+    indices = ivy.gather(sort_indices, ivy.array(k - 1), axis=axis)
+
+    if keepdim:
+        values = ivy.expand_dims(values, axis=axis)
+        indices = ivy.expand_dims(indices, axis=axis)
+
+    ret = (values, indices)
+    return ret
+
+
 @with_supported_dtypes(
     {"2.5.1 and below": ("float32", "float64", "int32", "int64")},
     "paddle",


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_search.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_search.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_search.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_search.py
@@ -1,6 +1,7 @@
 # global
 import numpy as np
-from hypothesis import strategies as st
+from hypothesis import assume, strategies as st
+
 
 # local
 import ivy_tests.test_ivy.helpers as helpers
@@ -148,6 +149,45 @@ def test_paddle_argsort(
     )
 
 
+# kthvalue
+@handle_frontend_test(
+    fn_tree="paddle.kthvalue",
+    dtype_input_axis=helpers.dtype_values_axis(
+        available_dtypes=helpers.get_dtypes("valid"),
+        min_num_dims=2,
+        valid_axis=True,
+        force_int_axis=True,
+    ).filter(lambda v: len(np.unique(v[1][0])) == len(np.ravel(v[1][0]))),
+    k=st.integers(min_value=1),
+    keepdim=st.booleans(),
+)
+def test_paddle_kthvalue(
+    *,
+    dtype_input_axis,
+    k,
+    keepdim,
+    on_device,
+    fn_tree,
+    frontend,
+    test_flags,
+    backend_fw,
+):
+    input_dtype, x, axis = dtype_input_axis
+    assume(k <= x[0].shape[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,
+        x=x[0],
+        k=k,
+        axis=axis,
+        keepdim=keepdim,
+    )
+
+
 @handle_frontend_test(
     fn_tree="paddle.masked_select",
     dtype_input_mask=_dtypes_input_mask(),