prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add Sparse Array Functions to Paddle Backend
  Add [Sparse Array Functions](https://www.paddlepaddle.org.cn/documentation/docs/en/api/index\_en.html) to Paddle backend
  
  \_
  
  >Please keep in mind that the proper way to link an issue to this list is to comment "- [ ] #issue\_number" while the issue's title only includes the name of the function you've chosen.
  
  \_
  
  ## Experimental
  
  - [x] is\_native\_sparse\_array
  - [x] native\_sparse\_array
  - [x] native\_sparse\_array\_to\_indices\_values\_and\_shape
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ivy/functional/backends/paddle/experimental/sparse_array.py`
  Content:
  ```
  1 from ivy.utils.exceptions import IvyNotImplementedException
  2 import paddle
  3 
  4 
  5 def is_native_sparse_array(x: paddle.Tensor) -> bool:
  6     return x.is_sparse_coo() or x.is_sparse_csr()
  7 
  8 
  9 def native_sparse_array(
  10     data=None,
  11     *,
  12     coo_indices=None,
  13     crow_indices=None,
  14     col_indices=None,
  15     ccol_indices=None,
  16     row_indices=None,
  17     values=None,
  18     dense_shape=None,
  19     format="coo",
  20 ):
  21     raise IvyNotImplementedException()
  22 
  23 
  24 def native_sparse_array_to_indices_values_and_shape(x):
  25     raise IvyNotImplementedException()
  26
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/ivy/functional/backends/paddle/experimental/sparse_array.py b/ivy/functional/backends/paddle/experimental/sparse_array.py
  --- a/ivy/functional/backends/paddle/experimental/sparse_array.py
  +++ b/ivy/functional/backends/paddle/experimental/sparse_array.py
  @@ -1,11 +1,26 @@
  +import ivy
  +from ivy.functional.ivy.experimental.sparse_array import (
  +    _verify_coo_components,
  +    _verify_csr_components,
  +    _is_data_not_indices_values_and_shape,
  +)
  +from ivy.func_wrapper import (
  +    with_unsupported_device_and_dtypes,
  +)
   from ivy.utils.exceptions import IvyNotImplementedException
   import paddle
   
  +# local
  +from .. import backend_version
  +
   
   def is_native_sparse_array(x: paddle.Tensor) -> bool:
       return x.is_sparse_coo() or x.is_sparse_csr()
   
   
  +@with_unsupported_device_and_dtypes(
  +    {"2.4.2 and below": {"cpu": ("int8",)}}, backend_version
  +)
   def native_sparse_array(
       data=None,
       *,
  @@ -17,9 +32,67 @@
       values=None,
       dense_shape=None,
       format="coo",
  -):
  -    raise IvyNotImplementedException()
  +) -> paddle.Tensor:
  +    format = format.lower()
  +
  +    if format not in ["coo", "csr"]:
  +        raise IvyNotImplementedException(
  +            "paddle only supports 'coo' and 'csr' sparse formats."
  +        )
  +
  +    if _is_data_not_indices_values_and_shape(
  +        data,
  +        coo_indices,
  +        crow_indices,
  +        col_indices,
  +        ccol_indices,
  +        row_indices,
  +        values,
  +        dense_shape,
  +    ):
  +        ivy.utils.assertions.check_true(
  +            ivy.is_native_sparse_array(data), message="not a sparse array"
  +        )
  +        return data
  +
  +    if format == "coo":
  +        _verify_coo_components(
  +            indices=coo_indices, values=values, dense_shape=dense_shape
  +        )
  +        return paddle.sparse.sparse_coo_tensor(
  +            indices=coo_indices,
  +            values=values,
  +            shape=dense_shape,
  +            dtype=dtype,
  +            place=device,
  +            stop_gradient=not requires_grad,
  +        )
  +    else:
  +        _verify_csr_components(
  +            crow_indices=crow_indices,
  +            col_indices=col_indices,
  +            values=values,
  +            dense_shape=dense_shape,
  +        )
  +        return paddle.sparse.sparse_csr_tensor(
  +            crows=crow_indices,
  +            cols=col_indices,
  +            values=values,
  +            shape=dense_shape,
  +            dtype=dtype,
  +            place=device,
  +            stop_gradient=not requires_grad,
  +        )
   
   
   def native_sparse_array_to_indices_values_and_shape(x):
  -    raise IvyNotImplementedException()
  +    if not is_native_sparse_array(x):
  +        raise ivy.utils.exceptions.IvyException("not a Paddle Sparse Array")
  +    if x.is_sparse_coo():
  +        return {"coo_indices": x.indices()}, x.values(), x.shape
  +    else:
  +        return (
  +            {"crow_indices": x.crows(), "col_indices": x.cols()},
  +            x.values(),
  +            x.shape,
  +        )
  
verification_info: {"golden_diff": "diff --git a/ivy/functional/backends/paddle/experimental/sparse_array.py b/ivy/functional/backends/paddle/experimental/sparse_array.py\n--- a/ivy/functional/backends/paddle/experimental/sparse_array.py\n+++ b/ivy/functional/backends/paddle/experimental/sparse_array.py\n@@ -1,11 +1,26 @@\n+import ivy\n+from ivy.functional.ivy.experimental.sparse_array import (\n+    _verify_coo_components,\n+    _verify_csr_components,\n+    _is_data_not_indices_values_and_shape,\n+)\n+from ivy.func_wrapper import (\n+    with_unsupported_device_and_dtypes,\n+)\n from ivy.utils.exceptions import IvyNotImplementedException\n import paddle\n \n+# local\n+from .. import backend_version\n+\n \n def is_native_sparse_array(x: paddle.Tensor) -> bool:\n     return x.is_sparse_coo() or x.is_sparse_csr()\n \n \n+@with_unsupported_device_and_dtypes(\n+    {\"2.4.2 and below\": {\"cpu\": (\"int8\",)}}, backend_version\n+)\n def native_sparse_array(\n     data=None,\n     *,\n@@ -17,9 +32,67 @@\n     values=None,\n     dense_shape=None,\n     format=\"coo\",\n-):\n-    raise IvyNotImplementedException()\n+) -> paddle.Tensor:\n+    format = format.lower()\n+\n+    if format not in [\"coo\", \"csr\"]:\n+        raise IvyNotImplementedException(\n+            \"paddle only supports 'coo' and 'csr' sparse formats.\"\n+        )\n+\n+    if _is_data_not_indices_values_and_shape(\n+        data,\n+        coo_indices,\n+        crow_indices,\n+        col_indices,\n+        ccol_indices,\n+        row_indices,\n+        values,\n+        dense_shape,\n+    ):\n+        ivy.utils.assertions.check_true(\n+            ivy.is_native_sparse_array(data), message=\"not a sparse array\"\n+        )\n+        return data\n+\n+    if format == \"coo\":\n+        _verify_coo_components(\n+            indices=coo_indices, values=values, dense_shape=dense_shape\n+        )\n+        return paddle.sparse.sparse_coo_tensor(\n+            indices=coo_indices,\n+            values=values,\n+            shape=dense_shape,\n+            dtype=dtype,\n+            place=device,\n+            stop_gradient=not requires_grad,\n+        )\n+    else:\n+        _verify_csr_components(\n+            crow_indices=crow_indices,\n+            col_indices=col_indices,\n+            values=values,\n+            dense_shape=dense_shape,\n+        )\n+        return paddle.sparse.sparse_csr_tensor(\n+            crows=crow_indices,\n+            cols=col_indices,\n+            values=values,\n+            shape=dense_shape,\n+            dtype=dtype,\n+            place=device,\n+            stop_gradient=not requires_grad,\n+        )\n \n \n def native_sparse_array_to_indices_values_and_shape(x):\n-    raise IvyNotImplementedException()\n+    if not is_native_sparse_array(x):\n+        raise ivy.utils.exceptions.IvyException(\"not a Paddle Sparse Array\")\n+    if x.is_sparse_coo():\n+        return {\"coo_indices\": x.indices()}, x.values(), x.shape\n+    else:\n+        return (\n+            {\"crow_indices\": x.crows(), \"col_indices\": x.cols()},\n+            x.values(),\n+            x.shape,\n+        )\n", "issue": "Add Sparse Array Functions to Paddle Backend\nAdd [Sparse Array Functions](https://www.paddlepaddle.org.cn/documentation/docs/en/api/index\\_en.html) to Paddle backend\r\n\r\n\\_\r\n\r\n>Please keep in mind that the proper way to link an issue to this list is to comment \"- [ ] #issue\\_number\" while the issue's title only includes the name of the function you've chosen.\r\n\r\n\\_\r\n\r\n## Experimental\r\n\r\n- [x] is\\_native\\_sparse\\_array\r\n- [x] native\\_sparse\\_array\r\n- [x] native\\_sparse\\_array\\_to\\_indices\\_values\\_and\\_shape\n", "before_files": [{"content": "from ivy.utils.exceptions import IvyNotImplementedException\nimport paddle\n\n\ndef is_native_sparse_array(x: paddle.Tensor) -> bool:\n    return x.is_sparse_coo() or x.is_sparse_csr()\n\n\ndef native_sparse_array(\n    data=None,\n    *,\n    coo_indices=None,\n    crow_indices=None,\n    col_indices=None,\n    ccol_indices=None,\n    row_indices=None,\n    values=None,\n    dense_shape=None,\n    format=\"coo\",\n):\n    raise IvyNotImplementedException()\n\n\ndef native_sparse_array_to_indices_values_and_shape(x):\n    raise IvyNotImplementedException()\n", "path": "ivy/functional/backends/paddle/experimental/sparse_array.py"}], "after_files": [{"content": "import ivy\nfrom ivy.functional.ivy.experimental.sparse_array import (\n    _verify_coo_components,\n    _verify_csr_components,\n    _is_data_not_indices_values_and_shape,\n)\nfrom ivy.func_wrapper import (\n    with_unsupported_device_and_dtypes,\n)\nfrom ivy.utils.exceptions import IvyNotImplementedException\nimport paddle\n\n# local\nfrom .. import backend_version\n\n\ndef is_native_sparse_array(x: paddle.Tensor) -> bool:\n    return x.is_sparse_coo() or x.is_sparse_csr()\n\n\n@with_unsupported_device_and_dtypes(\n    {\"2.4.2 and below\": {\"cpu\": (\"int8\",)}}, backend_version\n)\ndef native_sparse_array(\n    data=None,\n    *,\n    coo_indices=None,\n    crow_indices=None,\n    col_indices=None,\n    ccol_indices=None,\n    row_indices=None,\n    values=None,\n    dense_shape=None,\n    format=\"coo\",\n) -> paddle.Tensor:\n    format = format.lower()\n\n    if format not in [\"coo\", \"csr\"]:\n        raise IvyNotImplementedException(\n            \"paddle only supports 'coo' and 'csr' sparse formats.\"\n        )\n\n    if _is_data_not_indices_values_and_shape(\n        data,\n        coo_indices,\n        crow_indices,\n        col_indices,\n        ccol_indices,\n        row_indices,\n        values,\n        dense_shape,\n    ):\n        ivy.utils.assertions.check_true(\n            ivy.is_native_sparse_array(data), message=\"not a sparse array\"\n        )\n        return data\n\n    if format == \"coo\":\n        _verify_coo_components(\n            indices=coo_indices, values=values, dense_shape=dense_shape\n        )\n        return paddle.sparse.sparse_coo_tensor(\n            indices=coo_indices,\n            values=values,\n            shape=dense_shape,\n            dtype=dtype,\n            place=device,\n            stop_gradient=not requires_grad,\n        )\n    else:\n        _verify_csr_components(\n            crow_indices=crow_indices,\n            col_indices=col_indices,\n            values=values,\n            dense_shape=dense_shape,\n        )\n        return paddle.sparse.sparse_csr_tensor(\n            crows=crow_indices,\n            cols=col_indices,\n            values=values,\n            shape=dense_shape,\n            dtype=dtype,\n            place=device,\n            stop_gradient=not requires_grad,\n        )\n\n\ndef native_sparse_array_to_indices_values_and_shape(x):\n    if not is_native_sparse_array(x):\n        raise ivy.utils.exceptions.IvyException(\"not a Paddle Sparse Array\")\n    if x.is_sparse_coo():\n        return {\"coo_indices\": x.indices()}, x.values(), x.shape\n    else:\n        return (\n            {\"crow_indices\": x.crows(), \"col_indices\": x.cols()},\n            x.values(),\n            x.shape,\n        )\n", "path": "ivy/functional/backends/paddle/experimental/sparse_array.py"}]}