From 8582e22a03e172a757fae6e76805904b71efe276 Mon Sep 17 00:00:00 2001 From: Torus403 <52376024+Torus403@users.noreply.github.com> Date: Thu, 13 Oct 2022 17:42:02 +0100 Subject: [PATCH 1/6] Added arccos, arrcosh, arcsin, arcsinh --- .../jax/numpy/name_space_functions.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ivy/functional/frontends/jax/numpy/name_space_functions.py b/ivy/functional/frontends/jax/numpy/name_space_functions.py index db2dd12e53bfe..5112fb67c7f90 100644 --- a/ivy/functional/frontends/jax/numpy/name_space_functions.py +++ b/ivy/functional/frontends/jax/numpy/name_space_functions.py @@ -188,3 +188,23 @@ def sinh(x): @inputs_to_ivy_arrays def sin(x): return ivy.sin(x) + + +@inputs_to_ivy_arrays +def arccos(x1, x2): + return ivy.acos(x1, x2) + + +@inputs_to_ivy_arrays +def arccosh(x1, x2): + return ivy.acosh(x1, x2) + + +@inputs_to_ivy_arrays +def arcsin(x1, x2): + return ivy.asin(x1, x2) + + +@inputs_to_ivy_arrays +def arcsinh(x1, x2): + return ivy.asinh(x1, x2) From 341fd9df03772189697096b26b80efbbf707d2e5 Mon Sep 17 00:00:00 2001 From: Torus403 <52376024+Torus403@users.noreply.github.com> Date: Thu, 13 Oct 2022 17:43:22 +0100 Subject: [PATCH 2/6] Added arccos, arrcosh, arcsin, arcsinh tests --- .../test_jax_numpy_namespace_functions.py | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py index 70e638861e005..599ccc0a148f4 100644 --- a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py +++ b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py @@ -903,3 +903,127 @@ def test_jax_numpy_sin( fn_tree="numpy.sin", x=x[0], ) + + +# arccos +@handle_cmd_line_args +@given( + dtype_and_x=helpers.dtype_and_values(available_dtypes=helpers.get_dtypes("float")), + dtype=helpers.get_dtypes("float", full=False, none=True), + num_positional_args=helpers.num_positional_args( + fn_name="ivy.functional.frontends.jax.numpy.arccos" + ), +) +def test_jax_numpy_arccos( + dtype_and_x, + dtype, + as_variable, + with_out, + num_positional_args, + native_array, + fw, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_function( + input_dtypes=input_dtype, + as_variable_flags=as_variable, + with_out=with_out, + num_positional_args=num_positional_args, + native_array_flags=native_array, + frontend="jax", + fn_tree="numpy.arccos", + x=x[0], + ) + + +# arccosh +@handle_cmd_line_args +@given( + dtype_and_x=helpers.dtype_and_values(available_dtypes=helpers.get_dtypes("float")), + dtype=helpers.get_dtypes("float", full=False, none=True), + num_positional_args=helpers.num_positional_args( + fn_name="ivy.functional.frontends.jax.numpy.arccosh" + ), +) +def test_jax_numpy_arccosh( + dtype_and_x, + dtype, + as_variable, + with_out, + num_positional_args, + native_array, + fw, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_function( + input_dtypes=input_dtype, + as_variable_flags=as_variable, + with_out=with_out, + num_positional_args=num_positional_args, + native_array_flags=native_array, + frontend="jax", + fn_tree="numpy.arccosh", + x=x[0], + ) + + +# arcsin +@handle_cmd_line_args +@given( + dtype_and_x=helpers.dtype_and_values(available_dtypes=helpers.get_dtypes("float")), + dtype=helpers.get_dtypes("float", full=False, none=True), + num_positional_args=helpers.num_positional_args( + fn_name="ivy.functional.frontends.jax.numpy.arcsin" + ), +) +def test_jax_numpy_arcsin( + dtype_and_x, + dtype, + as_variable, + with_out, + num_positional_args, + native_array, + fw, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_function( + input_dtypes=input_dtype, + as_variable_flags=as_variable, + with_out=with_out, + num_positional_args=num_positional_args, + native_array_flags=native_array, + frontend="jax", + fn_tree="numpy.arcsin", + x=x[0], + ) + + +# arcsinh +@handle_cmd_line_args +@given( + dtype_and_x=helpers.dtype_and_values(available_dtypes=helpers.get_dtypes("float")), + dtype=helpers.get_dtypes("float", full=False, none=True), + num_positional_args=helpers.num_positional_args( + fn_name="ivy.functional.frontends.jax.numpy.arcsinh" + ), +) +def test_jax_numpy_arcsinh( + dtype_and_x, + dtype, + as_variable, + with_out, + num_positional_args, + native_array, + fw, +): + input_dtype, x = dtype_and_x + helpers.test_frontend_function( + input_dtypes=input_dtype, + as_variable_flags=as_variable, + with_out=with_out, + num_positional_args=num_positional_args, + native_array_flags=native_array, + frontend="jax", + fn_tree="numpy.arcsinh", + x=x[0], + ) From b4a89cb2341d61ef68cc9cbabac13fd09efbf534 Mon Sep 17 00:00:00 2001 From: Torus403 <52376024+Torus403@users.noreply.github.com> Date: Sun, 16 Oct 2022 11:00:48 +0100 Subject: [PATCH 3/6] Update name_space_functions.py --- .../frontends/jax/numpy/name_space_functions.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ivy/functional/frontends/jax/numpy/name_space_functions.py b/ivy/functional/frontends/jax/numpy/name_space_functions.py index 5112fb67c7f90..ff99b95844a6b 100644 --- a/ivy/functional/frontends/jax/numpy/name_space_functions.py +++ b/ivy/functional/frontends/jax/numpy/name_space_functions.py @@ -191,20 +191,20 @@ def sin(x): @inputs_to_ivy_arrays -def arccos(x1, x2): - return ivy.acos(x1, x2) +def arccos(x): + return ivy.acos(x) @inputs_to_ivy_arrays -def arccosh(x1, x2): - return ivy.acosh(x1, x2) +def arccosh(x): + return ivy.acosh(x) @inputs_to_ivy_arrays -def arcsin(x1, x2): - return ivy.asin(x1, x2) +def arcsin(x): + return ivy.asin(x) @inputs_to_ivy_arrays -def arcsinh(x1, x2): - return ivy.asinh(x1, x2) +def arcsinh(x): + return ivy.asinh(x) From 378f8c249f2635640dfbba0f3f50dfe56dc276a4 Mon Sep 17 00:00:00 2001 From: Torus403 <52376024+Torus403@users.noreply.github.com> Date: Sun, 16 Oct 2022 11:06:05 +0100 Subject: [PATCH 4/6] Update test_jax_numpy_namespace_functions.py --- .../test_jax/test_jax_numpy_namespace_functions.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py index 599ccc0a148f4..9e1724618efb1 100644 --- a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py +++ b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py @@ -934,15 +934,15 @@ def test_jax_numpy_arccos( fn_tree="numpy.arccos", x=x[0], ) - + # arccosh @handle_cmd_line_args @given( dtype_and_x=helpers.dtype_and_values(available_dtypes=helpers.get_dtypes("float")), dtype=helpers.get_dtypes("float", full=False, none=True), num_positional_args=helpers.num_positional_args( - fn_name="ivy.functional.frontends.jax.numpy.arccosh" + fn_name="ivy.functional.frontends.jax.numpy.arcosh" ), ) def test_jax_numpy_arccosh( @@ -965,7 +965,7 @@ def test_jax_numpy_arccosh( fn_tree="numpy.arccosh", x=x[0], ) - + # arcsin @handle_cmd_line_args @@ -995,8 +995,8 @@ def test_jax_numpy_arcsin( frontend="jax", fn_tree="numpy.arcsin", x=x[0], - ) - + ) + # arcsinh @handle_cmd_line_args @@ -1026,4 +1026,6 @@ def test_jax_numpy_arcsinh( frontend="jax", fn_tree="numpy.arcsinh", x=x[0], - ) + ) + + From af2a8b193d03485c10cc05611c0ff0276f43f548 Mon Sep 17 00:00:00 2001 From: modanesh Date: Sun, 16 Oct 2022 15:03:14 +0330 Subject: [PATCH 5/6] fixing spaces for lint checks --- .../test_jax_numpy_namespace_functions.py | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py index 701f077b2626a..acfe6230fc898 100644 --- a/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py +++ b/ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_namespace_functions.py @@ -1015,8 +1015,8 @@ def test_jax_numpy_arccos( fn_tree="numpy.arccos", x=x[0], ) - - + + # arccosh @handle_cmd_line_args @given( @@ -1045,9 +1045,9 @@ def test_jax_numpy_arccosh( frontend="jax", fn_tree="numpy.arccosh", x=x[0], - ) - - + ) + + # arcsin @handle_cmd_line_args @given( @@ -1076,9 +1076,9 @@ def test_jax_numpy_arcsin( frontend="jax", fn_tree="numpy.arcsin", x=x[0], - ) - - + ) + + # arcsinh @handle_cmd_line_args @given( @@ -1107,6 +1107,4 @@ def test_jax_numpy_arcsinh( frontend="jax", fn_tree="numpy.arcsinh", x=x[0], - ) - - \ No newline at end of file + ) From 323d0bfa852c87fccfd10dbd2a18caf67414802c Mon Sep 17 00:00:00 2001 From: modanesh Date: Sun, 16 Oct 2022 15:06:00 +0330 Subject: [PATCH 6/6] fixing spaces for lint checks --- ivy/functional/frontends/jax/numpy/name_space_functions.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ivy/functional/frontends/jax/numpy/name_space_functions.py b/ivy/functional/frontends/jax/numpy/name_space_functions.py index fd569e646116e..3b322d4849c2d 100644 --- a/ivy/functional/frontends/jax/numpy/name_space_functions.py +++ b/ivy/functional/frontends/jax/numpy/name_space_functions.py @@ -225,4 +225,3 @@ def zeros(shape, dtype=None): if dtype is None: dtype = ivy.float64 return ivy.zeros(shape, dtype=dtype) -