We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
bernoulli


--- 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/random.py`
Content:
```
1 # global
2 from typing import Optional, Union, Sequence
3 import paddle
4 
5 from ivy import with_unsupported_device_and_dtypes
6 from ivy.functional.backends.paddle import backend_version
7 from ivy.utils.exceptions import IvyNotImplementedException
8 
9 # local
10 import ivy
11 from paddle.device import core
12 
13 # dirichlet
14 
15 
16 @with_unsupported_device_and_dtypes(
17     {
18         "2.5.1 and below": {
19             "cpu": (
20                 "int8",
21                 "int16",
22                 "uint8",
23                 "float16",
24                 "complex64",
25                 "complex128",
26                 "bool",
27             )
28         }
29     },
30     backend_version,
31 )
32 def dirichlet(
33     alpha: Union[paddle.Tensor, float, Sequence[float]],
34     /,
35     *,
36     size: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,
37     out: Optional[paddle.Tensor] = None,
38     seed: Optional[int] = None,
39     dtype: Optional[paddle.dtype] = None,
40 ) -> paddle.Tensor:
41     size = size if size is not None else len(alpha)
42     dtype = dtype if dtype is not None else paddle.float64
43     if seed is not None:
44         paddle.seed(seed)
45     res = paddle.to_tensor(
46         paddle.distribution.Dirichlet(concentration=alpha).sample(shape=size),
47         dtype=dtype,
48     )
49     return res
50 
51 
52 def beta(
53     alpha: Union[float, paddle.Tensor],
54     beta: Union[float, paddle.Tensor],
55     /,
56     *,
57     shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,
58     dtype: Optional[Union[paddle.dtype, ivy.Dtype]] = None,
59     device: core.Place = None,
60     seed: Optional[int] = None,
61     out: Optional[paddle.Tensor] = None,
62 ) -> paddle.Tensor:
63     raise IvyNotImplementedException()
64 
65 
66 def gamma(
67     alpha: Union[float, paddle.Tensor],
68     beta: Union[float, paddle.Tensor],
69     /,
70     *,
71     shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,
72     dtype: Optional[Union[paddle.dtype, ivy.Dtype]] = None,
73     device: core.Place = None,
74     seed: Optional[int] = None,
75     out: Optional[paddle.Tensor] = None,
76 ) -> paddle.Tensor:
77     raise IvyNotImplementedException()
78 
79 
80 def poisson(
81     lam: Union[float, paddle.Tensor],
82     *,
83     shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,
84     device: core.Place,
85     dtype: paddle.dtype,
86     seed: Optional[int] = None,
87     fill_value: Optional[Union[float, int]] = 0,
88     out: Optional[paddle.Tensor] = None,
89 ):
90     raise IvyNotImplementedException()
91 
92 
93 def bernoulli(
94     probs: Union[float, paddle.Tensor],
95     *,
96     logits: Union[float, paddle.Tensor] = None,
97     shape: Optional[Union[ivy.NativeArray, Sequence[int]]] = None,
98     device: core.Place,
99     dtype: paddle.dtype,
100     seed: Optional[int] = None,
101     out: Optional[paddle.Tensor] = None,
102 ) -> paddle.Tensor:
103     raise IvyNotImplementedException()
104
```
--- 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()

```

diff --git a/ivy/functional/backends/paddle/experimental/random.py b/ivy/functional/backends/paddle/experimental/random.py
--- a/ivy/functional/backends/paddle/experimental/random.py
+++ b/ivy/functional/backends/paddle/experimental/random.py
@@ -1,7 +1,7 @@
 # global
 from typing import Optional, Union, Sequence
 import paddle
-
+from ivy.functional.backends.paddle.device import to_device
 from ivy import with_unsupported_device_and_dtypes
 from ivy.functional.backends.paddle import backend_version
 from ivy.utils.exceptions import IvyNotImplementedException
@@ -9,6 +9,7 @@
 # local
 import ivy
 from paddle.device import core
+from ivy import with_supported_device_and_dtypes
 
 # dirichlet
 
@@ -90,6 +91,23 @@
     raise IvyNotImplementedException()
 
 
+# bernoulli
+@with_supported_device_and_dtypes(
+    {
+        "2.5.0 and above": {
+            "cpu": ("float32", "float64"),
+            "gpu": ("bfloat16", "float16", "float32", "float64"),
+        },
+        "2.4.2 and below": {
+            "cpu": (
+                "float32",
+                "float64",
+            ),
+            "gpu": ("float16", "float32", "float64"),
+        },
+    },
+    backend_version,
+)
 def bernoulli(
     probs: Union[float, paddle.Tensor],
     *,
@@ -100,4 +118,14 @@
     seed: Optional[int] = None,
     out: Optional[paddle.Tensor] = None,
 ) -> paddle.Tensor:
-    raise IvyNotImplementedException()
+    if seed is not None:
+        paddle.seed(seed)
+    if probs is not None:
+        probs = probs
+    elif logits is not None:
+        probs = ivy.softmax(logits)
+    probs = paddle.cast(probs, dtype)
+    probs = paddle.unsqueeze(probs, 0) if len(probs.shape) == 0 else probs
+    probs = paddle.maximum(probs, paddle.full_like(probs, 1e-6))
+    sample = paddle.bernoulli(probs)
+    return to_device(sample, device)

{"golden_diff": "diff --git a/ivy/functional/backends/paddle/experimental/random.py b/ivy/functional/backends/paddle/experimental/random.py\n--- a/ivy/functional/backends/paddle/experimental/random.py\n+++ b/ivy/functional/backends/paddle/experimental/random.py\n@@ -1,7 +1,7 @@\n # global\n from typing import Optional, Union, Sequence\n import paddle\n-\n+from ivy.functional.backends.paddle.device import to_device\n from ivy import with_unsupported_device_and_dtypes\n from ivy.functional.backends.paddle import backend_version\n from ivy.utils.exceptions import IvyNotImplementedException\n@@ -9,6 +9,7 @@\n # local\n import ivy\n from paddle.device import core\n+from ivy import with_supported_device_and_dtypes\n \n # dirichlet\n \n@@ -90,6 +91,23 @@\n     raise IvyNotImplementedException()\n \n \n+# bernoulli\n+@with_supported_device_and_dtypes(\n+    {\n+        \"2.5.0 and above\": {\n+            \"cpu\": (\"float32\", \"float64\"),\n+            \"gpu\": (\"bfloat16\", \"float16\", \"float32\", \"float64\"),\n+        },\n+        \"2.4.2 and below\": {\n+            \"cpu\": (\n+                \"float32\",\n+                \"float64\",\n+            ),\n+            \"gpu\": (\"float16\", \"float32\", \"float64\"),\n+        },\n+    },\n+    backend_version,\n+)\n def bernoulli(\n     probs: Union[float, paddle.Tensor],\n     *,\n@@ -100,4 +118,14 @@\n     seed: Optional[int] = None,\n     out: Optional[paddle.Tensor] = None,\n ) -> paddle.Tensor:\n-    raise IvyNotImplementedException()\n+    if seed is not None:\n+        paddle.seed(seed)\n+    if probs is not None:\n+        probs = probs\n+    elif logits is not None:\n+        probs = ivy.softmax(logits)\n+    probs = paddle.cast(probs, dtype)\n+    probs = paddle.unsqueeze(probs, 0) if len(probs.shape) == 0 else probs\n+    probs = paddle.maximum(probs, paddle.full_like(probs, 1e-6))\n+    sample = paddle.bernoulli(probs)\n+    return to_device(sample, device)\n", "issue": "bernoulli\n\n", "before_files": [{"content": "# global\nfrom typing import Optional, Union, Sequence\nimport paddle\n\nfrom ivy import with_unsupported_device_and_dtypes\nfrom ivy.functional.backends.paddle import backend_version\nfrom ivy.utils.exceptions import IvyNotImplementedException\n\n# local\nimport ivy\nfrom paddle.device import core\n\n# dirichlet\n\n\n@with_unsupported_device_and_dtypes(\n    {\n        \"2.5.1 and below\": {\n            \"cpu\": (\n                \"int8\",\n                \"int16\",\n                \"uint8\",\n                \"float16\",\n                \"complex64\",\n                \"complex128\",\n                \"bool\",\n            )\n        }\n    },\n    backend_version,\n)\ndef dirichlet(\n    alpha: Union[paddle.Tensor, float, Sequence[float]],\n    /,\n    *,\n    size: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,\n    out: Optional[paddle.Tensor] = None,\n    seed: Optional[int] = None,\n    dtype: Optional[paddle.dtype] = None,\n) -> paddle.Tensor:\n    size = size if size is not None else len(alpha)\n    dtype = dtype if dtype is not None else paddle.float64\n    if seed is not None:\n        paddle.seed(seed)\n    res = paddle.to_tensor(\n        paddle.distribution.Dirichlet(concentration=alpha).sample(shape=size),\n        dtype=dtype,\n    )\n    return res\n\n\ndef beta(\n    alpha: Union[float, paddle.Tensor],\n    beta: Union[float, paddle.Tensor],\n    /,\n    *,\n    shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,\n    dtype: Optional[Union[paddle.dtype, ivy.Dtype]] = None,\n    device: core.Place = None,\n    seed: Optional[int] = None,\n    out: Optional[paddle.Tensor] = None,\n) -> paddle.Tensor:\n    raise IvyNotImplementedException()\n\n\ndef gamma(\n    alpha: Union[float, paddle.Tensor],\n    beta: Union[float, paddle.Tensor],\n    /,\n    *,\n    shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,\n    dtype: Optional[Union[paddle.dtype, ivy.Dtype]] = None,\n    device: core.Place = None,\n    seed: Optional[int] = None,\n    out: Optional[paddle.Tensor] = None,\n) -> paddle.Tensor:\n    raise IvyNotImplementedException()\n\n\ndef poisson(\n    lam: Union[float, paddle.Tensor],\n    *,\n    shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,\n    device: core.Place,\n    dtype: paddle.dtype,\n    seed: Optional[int] = None,\n    fill_value: Optional[Union[float, int]] = 0,\n    out: Optional[paddle.Tensor] = None,\n):\n    raise IvyNotImplementedException()\n\n\ndef bernoulli(\n    probs: Union[float, paddle.Tensor],\n    *,\n    logits: Union[float, paddle.Tensor] = None,\n    shape: Optional[Union[ivy.NativeArray, Sequence[int]]] = None,\n    device: core.Place,\n    dtype: paddle.dtype,\n    seed: Optional[int] = None,\n    out: Optional[paddle.Tensor] = None,\n) -> paddle.Tensor:\n    raise IvyNotImplementedException()\n", "path": "ivy/functional/backends/paddle/experimental/random.py"}], "after_files": [{"content": "# global\nfrom typing import Optional, Union, Sequence\nimport paddle\nfrom ivy.functional.backends.paddle.device import to_device\nfrom ivy import with_unsupported_device_and_dtypes\nfrom ivy.functional.backends.paddle import backend_version\nfrom ivy.utils.exceptions import IvyNotImplementedException\n\n# local\nimport ivy\nfrom paddle.device import core\nfrom ivy import with_supported_device_and_dtypes\n\n# dirichlet\n\n\n@with_unsupported_device_and_dtypes(\n    {\n        \"2.5.1 and below\": {\n            \"cpu\": (\n                \"int8\",\n                \"int16\",\n                \"uint8\",\n                \"float16\",\n                \"complex64\",\n                \"complex128\",\n                \"bool\",\n            )\n        }\n    },\n    backend_version,\n)\ndef dirichlet(\n    alpha: Union[paddle.Tensor, float, Sequence[float]],\n    /,\n    *,\n    size: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,\n    out: Optional[paddle.Tensor] = None,\n    seed: Optional[int] = None,\n    dtype: Optional[paddle.dtype] = None,\n) -> paddle.Tensor:\n    size = size if size is not None else len(alpha)\n    dtype = dtype if dtype is not None else paddle.float64\n    if seed is not None:\n        paddle.seed(seed)\n    res = paddle.to_tensor(\n        paddle.distribution.Dirichlet(concentration=alpha).sample(shape=size),\n        dtype=dtype,\n    )\n    return res\n\n\ndef beta(\n    alpha: Union[float, paddle.Tensor],\n    beta: Union[float, paddle.Tensor],\n    /,\n    *,\n    shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,\n    dtype: Optional[Union[paddle.dtype, ivy.Dtype]] = None,\n    device: core.Place = None,\n    seed: Optional[int] = None,\n    out: Optional[paddle.Tensor] = None,\n) -> paddle.Tensor:\n    raise IvyNotImplementedException()\n\n\ndef gamma(\n    alpha: Union[float, paddle.Tensor],\n    beta: Union[float, paddle.Tensor],\n    /,\n    *,\n    shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,\n    dtype: Optional[Union[paddle.dtype, ivy.Dtype]] = None,\n    device: core.Place = None,\n    seed: Optional[int] = None,\n    out: Optional[paddle.Tensor] = None,\n) -> paddle.Tensor:\n    raise IvyNotImplementedException()\n\n\ndef poisson(\n    lam: Union[float, paddle.Tensor],\n    *,\n    shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,\n    device: core.Place,\n    dtype: paddle.dtype,\n    seed: Optional[int] = None,\n    fill_value: Optional[Union[float, int]] = 0,\n    out: Optional[paddle.Tensor] = None,\n):\n    raise IvyNotImplementedException()\n\n\n# bernoulli\n@with_supported_device_and_dtypes(\n    {\n        \"2.5.0 and above\": {\n            \"cpu\": (\"float32\", \"float64\"),\n            \"gpu\": (\"bfloat16\", \"float16\", \"float32\", \"float64\"),\n        },\n        \"2.4.2 and below\": {\n            \"cpu\": (\n                \"float32\",\n                \"float64\",\n            ),\n            \"gpu\": (\"float16\", \"float32\", \"float64\"),\n        },\n    },\n    backend_version,\n)\ndef bernoulli(\n    probs: Union[float, paddle.Tensor],\n    *,\n    logits: Union[float, paddle.Tensor] = None,\n    shape: Optional[Union[ivy.NativeArray, Sequence[int]]] = None,\n    device: core.Place,\n    dtype: paddle.dtype,\n    seed: Optional[int] = None,\n    out: Optional[paddle.Tensor] = None,\n) -> paddle.Tensor:\n    if seed is not None:\n        paddle.seed(seed)\n    if probs is not None:\n        probs = probs\n    elif logits is not None:\n        probs = ivy.softmax(logits)\n    probs = paddle.cast(probs, dtype)\n    probs = paddle.unsqueeze(probs, 0) if len(probs.shape) == 0 else probs\n    probs = paddle.maximum(probs, paddle.full_like(probs, 1e-6))\n    sample = paddle.bernoulli(probs)\n    return to_device(sample, device)\n", "path": "ivy/functional/backends/paddle/experimental/random.py"}]}