Repository: ivy-llc/ivy

Issue:
lcm



Discussion:

Resolving patch:
diff --git a/ivy/functional/frontends/paddle/tensor/math.py b/ivy/functional/frontends/paddle/tensor/math.py
--- a/ivy/functional/frontends/paddle/tensor/math.py
+++ b/ivy/functional/frontends/paddle/tensor/math.py
@@ -240,6 +240,12 @@ def reciprocal(x, name=None):
     return ivy.reciprocal(x)
 
 
+@with_supported_dtypes({"2.5.0 and below": ("int32", "int64")}, "paddle")
+@to_ivy_arrays_and_back
+def lcm(x, y, name=None):
+    return ivy.lcm(x, y)
+
+
 @with_supported_dtypes(
     {"2.5.0 and below": ("float16", "float32", "float64", "int32", "int64")}, "paddle"
 )
diff --git a/ivy/functional/ivy/elementwise.py b/ivy/functional/ivy/elementwise.py
--- a/ivy/functional/ivy/elementwise.py
+++ b/ivy/functional/ivy/elementwise.py
@@ -6193,7 +6193,7 @@ def lcm(
     With :class:`ivy.Array` input:
 
     >>> x1=ivy.array([2, 3, 4])
-    >>> x2=ivy.array([5, 8, 15])
+    >>> x2=ivy.array([5, 7, 15])
     >>> x1.lcm(x1, x2)
     ivy.array([10, 21, 60])
     """


Test patch:
diff --git a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py
--- a/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py
+++ b/ivy_tests/test_ivy/test_frontends/test_paddle/test_tensor/test_paddle_math.py
@@ -937,6 +937,38 @@ def test_paddle_reciprocal(
         on_device=on_device,
         x=x[0],
     )
+ 
+
+# lcm
+@handle_frontend_test(
+    fn_tree="paddle.lcm",
+    dtype_and_x=helpers.dtype_and_values(
+        available_dtypes=helpers.get_dtypes("valid"),
+        num_arrays=2,
+        min_num_dims=1,
+        safety_factor_scale="log",
+        large_abs_safety_factor=2,
+        shared_dtype=True,
+    ),
+)
+def test_paddle_lcm(
+        *,
+        dtype_and_x,
+        on_device,
+        fn_tree,
+        frontend,
+        test_flags,
+):
+    input_dtype, x = dtype_and_x
+    helpers.test_frontend_function(
+        input_dtypes=input_dtype,
+        frontend=frontend,
+        fn_tree=fn_tree,
+        test_flags=test_flags,
+        on_device=on_device,
+        x=x[0],
+        y=x[1],
+    )
 
 
 # cumprod
@@ -953,12 +985,12 @@ def test_paddle_reciprocal(
     ),
 )
 def test_paddle_cumprod(
-    *,
-    dtype_and_x,
-    on_device,
-    fn_tree,
-    frontend,
-    test_flags,
+        *,
+        dtype_and_x,
+        on_device,
+        fn_tree,
+        frontend,
+        test_flags,
 ):
     input_dtype, x, axis = dtype_and_x
     helpers.test_frontend_function(
@@ -981,16 +1013,18 @@ def test_paddle_cumprod(
         available_dtypes=helpers.get_dtypes("valid"),
         num_arrays=2,
         min_num_dims=1,
+        safety_factor_scale="log",
+        large_abs_safety_factor=2,
         shared_dtype=True,
     ),
 )
 def test_paddle_gcd(
-    *,
-    dtype_and_x,
-    on_device,
-    fn_tree,
-    frontend,
-    test_flags,
+        *,
+        dtype_and_x,
+        on_device,
+        fn_tree,
+        frontend,
+        test_flags,
 ):
     input_dtype, x = dtype_and_x
     helpers.test_frontend_function(
@@ -1011,12 +1045,12 @@ def test_paddle_gcd(
     ),
 )
 def test_paddle_fmin(
-    *,
-    dtypes_and_x,
-    on_device,
-    fn_tree,
-    frontend,
-    test_flags,
+        *,
+        dtypes_and_x,
+        on_device,
+        fn_tree,
+        frontend,
+        test_flags,
 ):
     input_dtype, x = dtypes_and_x
     helpers.test_frontend_function(
@@ -1038,12 +1072,12 @@ def test_paddle_fmin(
     ),
 )
 def test_paddle_logit(
-    *,
-    dtype_and_x,
-    on_device,
-    fn_tree,
-    frontend,
-    test_flags,
+        *,
+        dtype_and_x,
+        on_device,
+        fn_tree,
+        frontend,
+        test_flags,
 ):
     input_dtype, x = dtype_and_x
     helpers.test_frontend_function(
@@ -1065,12 +1099,12 @@ def test_paddle_logit(
     ),
 )
 def test_paddle_isnan(
-    *,
-    dtype_and_x,
-    frontend,
-    test_flags,
-    fn_tree,
-    on_device,
+        *,
+        dtype_and_x,
+        frontend,
+        test_flags,
+        fn_tree,
+        on_device,
 ):
     input_dtype, x = dtype_and_x
     helpers.test_frontend_function(
@@ -1091,12 +1125,12 @@ def test_paddle_isnan(
     ),
 )
 def test_paddle_isfinite(
-    *,
-    dtype_and_x,
-    frontend,
-    test_flags,
-    fn_tree,
-    on_device,
+        *,
+        dtype_and_x,
+        frontend,
+        test_flags,
+        fn_tree,
+        on_device,
 ):
     input_dtype, x = dtype_and_x
     helpers.test_frontend_function(
@@ -1117,12 +1151,12 @@ def test_paddle_isfinite(
     ),
 )
 def test_paddle_isinf(
-    *,
-    dtype_and_x,
-    frontend,
-    test_flags,
-    fn_tree,
-    on_device,
+        *,
+        dtype_and_x,
+        frontend,
+        test_flags,
+        fn_tree,
+        on_device,
 ):
     input_dtype, x = dtype_and_x
     helpers.test_frontend_function(
@@ -1142,12 +1176,12 @@ def test_paddle_isinf(
     ),
 )
 def test_paddle_angle(
-    *,
-    dtype_and_x,
-    on_device,
-    fn_tree,
-    frontend,
-    test_flags,
+        *,
+        dtype_and_x,
+        on_device,
+        fn_tree,
+        frontend,
+        test_flags,
 ):
     input_dtype, x = dtype_and_x
     helpers.test_frontend_function(
@@ -1167,12 +1201,12 @@ def test_paddle_angle(
     ),
 )
 def test_paddle_fmax(
-    *,
-    dtypes_and_x,
-    on_device,
-    fn_tree,
-    frontend,
-    test_flags,
+        *,
+        dtypes_and_x,
+        on_device,
+        fn_tree,
+        frontend,
+        test_flags,
 ):
     input_dtype, x = dtypes_and_x
     helpers.test_frontend_function(
@@ -1195,12 +1229,12 @@ def test_paddle_fmax(
     ),
 )
 def test_paddle_minimum(
-    *,
-    dtype_and_x,
-    on_device,
-    fn_tree,
-    frontend,
-    test_flags,
+        *,
+        dtype_and_x,
+        on_device,
+        fn_tree,
+        frontend,
+        test_flags,
 ):
     input_dtype, x = dtype_and_x
     helpers.test_frontend_function(
@@ -1222,12 +1256,12 @@ def test_paddle_minimum(
     ),
 )
 def test_paddle_erf(
-    *,
-    dtype_and_x,
-    frontend,
-    test_flags,
-    fn_tree,
-    on_device,
+        *,
+        dtype_and_x,
+        frontend,
+        test_flags,
+        fn_tree,
+        on_device,
 ):
     input_dtype, x = dtype_and_x
     helpers.test_frontend_function(