prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  cosine_similarity
  #15051 
  
  --- 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/frontends/paddle/nn/functional/common.py`
  Content:
  ```
  1 # local
  2
  ```
  --- 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/frontends/paddle/nn/functional/common.py b/ivy/functional/frontends/paddle/nn/functional/common.py
  --- a/ivy/functional/frontends/paddle/nn/functional/common.py
  +++ b/ivy/functional/frontends/paddle/nn/functional/common.py
  @@ -1 +1,25 @@
   # local
  +import ivy
  +from ivy.functional.frontends.paddle.func_wrapper import to_ivy_arrays_and_back
  +from ivy.func_wrapper import with_unsupported_dtypes
  +
  +
  +@with_unsupported_dtypes({"2.0.1 and below": ("float16", "bfloat16")}, "torch")
  +@to_ivy_arrays_and_back
  +def cosine_similarity(x1, x2, *, axis=1, eps=1e-08):
  +    if len(x1.shape) == len(x2.shape) and len(x2.shape) >= 2:
  +        numerator = ivy.sum(x1 * x2, axis=axis)
  +        x1_squared_norm = ivy.sum(ivy.square(x1), axis=axis)
  +        x2_squared_norm = ivy.sum(ivy.square(x2), axis=axis)
  +    else:
  +        numerator = ivy.sum(x1 * x2)
  +        x1_squared_norm = ivy.sum(ivy.square(x1))
  +        x2_squared_norm = ivy.sum(ivy.square(x2))
  +
  +    x1_norm = ivy.sqrt(x1_squared_norm)
  +    x2_norm = ivy.sqrt(x2_squared_norm)
  +    norm_mm = x1_norm * x2_norm
  +    denominator = ivy.maximum(norm_mm, eps)
  +
  +    cosine = numerator / denominator
  +    return cosine
  
verification_info: {"golden_diff": "diff --git a/ivy/functional/frontends/paddle/nn/functional/common.py b/ivy/functional/frontends/paddle/nn/functional/common.py\n--- a/ivy/functional/frontends/paddle/nn/functional/common.py\n+++ b/ivy/functional/frontends/paddle/nn/functional/common.py\n@@ -1 +1,25 @@\n # local\n+import ivy\n+from ivy.functional.frontends.paddle.func_wrapper import to_ivy_arrays_and_back\n+from ivy.func_wrapper import with_unsupported_dtypes\n+\n+\n+@with_unsupported_dtypes({\"2.0.1 and below\": (\"float16\", \"bfloat16\")}, \"torch\")\n+@to_ivy_arrays_and_back\n+def cosine_similarity(x1, x2, *, axis=1, eps=1e-08):\n+    if len(x1.shape) == len(x2.shape) and len(x2.shape) >= 2:\n+        numerator = ivy.sum(x1 * x2, axis=axis)\n+        x1_squared_norm = ivy.sum(ivy.square(x1), axis=axis)\n+        x2_squared_norm = ivy.sum(ivy.square(x2), axis=axis)\n+    else:\n+        numerator = ivy.sum(x1 * x2)\n+        x1_squared_norm = ivy.sum(ivy.square(x1))\n+        x2_squared_norm = ivy.sum(ivy.square(x2))\n+\n+    x1_norm = ivy.sqrt(x1_squared_norm)\n+    x2_norm = ivy.sqrt(x2_squared_norm)\n+    norm_mm = x1_norm * x2_norm\n+    denominator = ivy.maximum(norm_mm, eps)\n+\n+    cosine = numerator / denominator\n+    return cosine\n", "issue": "cosine_similarity\n#15051 \n", "before_files": [{"content": "# local\n", "path": "ivy/functional/frontends/paddle/nn/functional/common.py"}], "after_files": [{"content": "# local\nimport ivy\nfrom ivy.functional.frontends.paddle.func_wrapper import to_ivy_arrays_and_back\nfrom ivy.func_wrapper import with_unsupported_dtypes\n\n\n@with_unsupported_dtypes({\"2.0.1 and below\": (\"float16\", \"bfloat16\")}, \"torch\")\n@to_ivy_arrays_and_back\ndef cosine_similarity(x1, x2, *, axis=1, eps=1e-08):\n    if len(x1.shape) == len(x2.shape) and len(x2.shape) >= 2:\n        numerator = ivy.sum(x1 * x2, axis=axis)\n        x1_squared_norm = ivy.sum(ivy.square(x1), axis=axis)\n        x2_squared_norm = ivy.sum(ivy.square(x2), axis=axis)\n    else:\n        numerator = ivy.sum(x1 * x2)\n        x1_squared_norm = ivy.sum(ivy.square(x1))\n        x2_squared_norm = ivy.sum(ivy.square(x2))\n\n    x1_norm = ivy.sqrt(x1_squared_norm)\n    x2_norm = ivy.sqrt(x2_squared_norm)\n    norm_mm = x1_norm * x2_norm\n    denominator = ivy.maximum(norm_mm, eps)\n\n    cosine = numerator / denominator\n    return cosine\n", "path": "ivy/functional/frontends/paddle/nn/functional/common.py"}]}