Repository: ivy-llc/ivy

Issue:
[Bug]: ivy.multi_dot infinite recursion on Paddle backend
### Bug Explanation

ivy.multi_dot produces the following error message when testing with paddle backend:

```
ivy.utils.exceptions.IvyBackendException: paddle: multi_dot: paddle: multi_dot: paddle: multi_dot: paddle: multi_dot: paddle: multi_dot: paddle: multi_dot:  . . .  paddle: nested_map: maximum recursion depth exceeded
```

### Steps to Reproduce Bug

Run any test for a function that invokes multi_dot. You can also run the test for multi_dot itself but you will need to edit the code to add the on_device argument.

For example, test numpy_multi_dot:

```
pytest ivy_tests/test_ivy/test_frontends/test_numpy/test_linalg/test_matrix_and_vector_products.py::test_numpy_multi_dot
```

### Environment

Environements tested:

- github codespaces, latest version of master
- pycharm with local conda interpreter

### Ivy Version

commit 1545a85 on master

### Backend

- [ ] NumPy
- [ ] TensorFlow
- [ ] PyTorch
- [ ] JAX

### Device

M1 Mac


Discussion:

Resolving patch:
diff --git a/ivy/functional/backends/paddle/experimental/linear_algebra.py b/ivy/functional/backends/paddle/experimental/linear_algebra.py
--- a/ivy/functional/backends/paddle/experimental/linear_algebra.py
+++ b/ivy/functional/backends/paddle/experimental/linear_algebra.py
@@ -4,7 +4,10 @@
 
 # local
 from ivy.functional.ivy.experimental.linear_algebra import _check_valid_dimension_size
-from ivy.func_wrapper import with_unsupported_device_and_dtypes
+from ivy.func_wrapper import (
+    with_unsupported_device_and_dtypes,
+    with_supported_device_and_dtypes,
+)
 from ivy.utils.exceptions import IvyNotImplementedException
 from .. import backend_version
 
@@ -117,3 +120,28 @@ def dot(
 
 
 dot.support_native_out = True
+
+
+@with_supported_device_and_dtypes(
+    {
+        "2.5.1 and below": {
+            "cpu": (
+                "float32",
+                "float64",
+            ),
+            "gpu": (
+                "float16",
+                "float32",
+                "float64",
+            ),
+        }
+    },
+    backend_version,
+)
+def multi_dot(
+    x: paddle.Tensor,
+    /,
+    *,
+    out: Optional[paddle.Tensor] = None,
+) -> paddle.Tensor:
+    return paddle.linalg.multi_dot(x)
diff --git a/ivy/functional/backends/torch/experimental/linear_algebra.py b/ivy/functional/backends/torch/experimental/linear_algebra.py
--- a/ivy/functional/backends/torch/experimental/linear_algebra.py
+++ b/ivy/functional/backends/torch/experimental/linear_algebra.py
@@ -155,6 +155,7 @@ def adjoint(
     return torch.adjoint(x).resolve_conj()
 
 
+@with_unsupported_dtypes({"2.0.1 and below": ("float16",)}, backend_version)
 def multi_dot(
     x: Sequence[torch.Tensor],
     /,


Test patch:
diff --git a/ivy_tests/array_api_testing/test_array_api b/ivy_tests/array_api_testing/test_array_api
--- a/ivy_tests/array_api_testing/test_array_api
+++ b/ivy_tests/array_api_testing/test_array_api
@@ -1 +1 @@
-Subproject commit f82c7bc8627cc2c3a44fa3e425f53a253a609aa8
+Subproject commit 852a1ddfedb14742ec94a9dfc6b3f3d4e89d0189
diff --git a/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_linalg.py b/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_linalg.py
--- a/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_linalg.py
+++ b/ivy_tests/test_ivy/test_functional/test_experimental/test_core/test_linalg.py
@@ -483,11 +483,12 @@ def _generate_multi_dot_dtype_and_arrays(draw):
     dtype_x=_generate_multi_dot_dtype_and_arrays(),
     test_gradients=st.just(False),
 )
-def test_multi_dot(dtype_x, test_flags, backend_fw, fn_name):
+def test_multi_dot(dtype_x, test_flags, backend_fw, fn_name, on_device):
     dtype, x = dtype_x
     helpers.test_function(
         input_dtypes=dtype,
         test_flags=test_flags,
+        on_device=on_device,
         backend_to_test=backend_fw,
         fn_name=fn_name,
         test_values=True,