diff --git a/ivy/functional/frontends/paddle/tensor/linalg.py b/ivy/functional/frontends/paddle/tensor/linalg.py index 68716390dfb5d..4ae10e9824324 100644 --- a/ivy/functional/frontends/paddle/tensor/linalg.py +++ b/ivy/functional/frontends/paddle/tensor/linalg.py @@ -175,6 +175,13 @@ def pinv(x, rcond=1e-15, hermitian=False, name=None): return ivy.pinv(x, rtol=rcond) +# qr +@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") +@to_ivy_arrays_and_back +def qr(x, mode="reduced", name=None): + return ivy.qr(x, mode=mode) + + # solve @with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle") @to_ivy_arrays_and_back diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_linalg.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_linalg.py index 6f3118326c4d9..1290c944bef8d 100644 --- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_linalg.py +++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_linalg.py @@ -7,6 +7,10 @@ import ivy_tests.test_ivy.helpers as helpers from ivy_tests.test_ivy.helpers import assert_all_close from ivy_tests.test_ivy.helpers import handle_frontend_test, matrix_is_stable +from ivy_tests.test_ivy.test_functional.test_core.test_linalg import ( + _get_dtype_and_matrix, +) + from ivy_tests.test_ivy.test_frontends.test_tensorflow.test_linalg import ( _get_second_matrix, _get_cholesky_matrix, @@ -835,6 +839,37 @@ def test_paddle_pinv( ) +# qr +@handle_frontend_test( + fn_tree="paddle.tensor.linalg.qr", + dtype_and_x=_get_dtype_and_matrix(), + mode=st.sampled_from(("reduced", "complete")), + test_with_out=st.just(False), +) +def test_paddle_qr( + dtype_and_x, + mode, + frontend, + test_flags, + fn_tree, + backend_fw, + on_device, +): + dtype, x = dtype_and_x + assume(matrix_is_stable(x[0])) + helpers.test_frontend_function( + input_dtypes=dtype, + frontend=frontend, + test_flags=test_flags, + backend_to_test=backend_fw, + fn_tree=fn_tree, + on_device=on_device, + rtol=1e-01, + x=x[0], + mode=mode, + ) + + # solve @handle_frontend_test( fn_tree="paddle.solve",