From 5623ddfc76384280c33182ca3ef0f1f3bc9bfe76 Mon Sep 17 00:00:00 2001 From: PRITAM PRAKASH JATHAR Date: Sun, 31 Jul 2022 01:39:34 +0530 Subject: [PATCH] Delete test_elementwise.py --- .../test_core/test_elementwise.py | 2182 ----------------- 1 file changed, 2182 deletions(-) delete mode 100644 ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py diff --git a/ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py b/ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py deleted file mode 100644 index 7be6fb0429f4d..0000000000000 --- a/ivy_tests/test_ivy/test_functional/test_core/test_elementwise.py +++ /dev/null @@ -1,2182 +0,0 @@ -"""Collection of tests for elementwise functions.""" - -# global -import numpy as np -from hypothesis import given, assume, strategies as st -from numbers import Number - - - -# local -import ivy -import ivy_tests.test_ivy.helpers as helpers -import ivy.functional.backends.numpy as ivy_np -#from ivy_tests.test_ivy import helpers - -#import ivy.functional.backends.numpy as ivy_np - - -# abs -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="abs"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_abs( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "abs", - x=np.asarray(x, dtype=input_dtype), - ) - - -# acosh -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="acosh"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) - - -def test_acosh( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "acosh", - x=np.asarray(x, dtype=input_dtype), - ) - - -# acos -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="acos"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_acos( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "acos", - x=np.asarray(x, dtype=input_dtype), - ) - - -# add -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="add"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_add( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "add", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# asin -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="asin"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_asin( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "asin", - x=np.asarray(x, dtype=input_dtype), - ) - - -# asinh -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="asinh"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_asinh( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "asinh", - x=np.asarray(x, dtype=input_dtype), - ) - - -# atan -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="atan"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_atan( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "atan", - x=np.asarray(x, dtype=input_dtype), - ) - - -# atan2 -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="atan2"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_atan2( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "atan2", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# atanh -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="atanh"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_atanh( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "atanh", - x=np.asarray(x, dtype=input_dtype), - ) - - -# bitwise_and -@given( - dtype_and_x=helpers.dtype_and_values(ivy.all_int_dtypes + ("bool",), 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="bitwise_and"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_bitwise_and( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "bitwise_and", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# bitwise_left_shift -@given( - dtype_and_x=helpers.dtype_and_values(ivy.all_int_dtypes), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="bitwise_left_shift"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_bitwise_left_shift( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - assume(x) - x1 = np.asarray(x, dtype=input_dtype) - n_bits = ivy.dtype_bits(input_dtype) - x2 = np.random.randint(n_bits, size=x1.shape, dtype=input_dtype) - helpers.test_function( - [input_dtype, input_dtype], - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "bitwise_left_shift", - x1=x1, - x2=x2, - ) - - -# bitwise_invert -@given( - dtype_and_x=helpers.dtype_and_values(ivy.all_int_dtypes + ("bool",)), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="bitwise_invert"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_bitwise_invert( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "bitwise_invert", - x=np.asarray(x, dtype=input_dtype), - ) - - -# bitwise_or -@given( - dtype_and_x=helpers.dtype_and_values(ivy.all_int_dtypes + ("bool",), 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="bitwise_or"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_bitwise_or( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "bitwise_or", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# bitwise_right_shift -@given( - dtype_and_x=helpers.dtype_and_values(ivy.all_int_dtypes), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="bitwise_right_shift"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_bitwise_right_shift( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - assume(x) - x1 = np.asarray(x, dtype=input_dtype) - n_bits = ivy.dtype_bits(input_dtype) - x2 = np.random.randint(n_bits, size=x1.shape, dtype=input_dtype) - helpers.test_function( - [input_dtype, input_dtype], - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "bitwise_right_shift", - x1=x1, - x2=x2, - ) - - -# bitwise_xor -@given( - dtype_and_x=helpers.dtype_and_values(ivy.all_int_dtypes + ("bool",), 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="bitwise_xor"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_bitwise_xor( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "bitwise_xor", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# ceil -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="ceil"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_ceil( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "ceil", - x=np.asarray(x, dtype=input_dtype), - ) - - -# cos -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="cos"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_cos( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "cos", - x=np.asarray(x, dtype=input_dtype), - ) - - -# cosh -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="cosh"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_cosh( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "cosh", - x=np.asarray(x, dtype=input_dtype), - ) - - -# divide -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="divide"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_divide( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - x1 = np.asarray(x[0], dtype=input_dtype[0]) - x2 = np.asarray(x[1], dtype=input_dtype[1]) - # ToDo: remove the checks below, and instead handle this during the - # hypothesis data generation - if np.any(x2 == 0): - return # don't divide by 0 - elif np.any(x1 > 9223372036854775807): - return # np.divide converts to signed int so values can't be too large - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "divide", - x1=x1, - x2=x2, - ) - - -# equal -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="equal"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_equal( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "equal", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# exp -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="exp"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_exp( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "exp", - x=np.asarray(x, dtype=input_dtype), - ) - - -# expm1 -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="expm1"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_expm1( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "expm1", - x=np.asarray(x, dtype=input_dtype), - ) - - -# floor -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="floor"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_floor( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "floor", - x=np.asarray(x, dtype=input_dtype), - ) - - -# floor_divide - don't allow inf as array API spec allows varying behaviour -# for special cases -@given( - dtype_and_x=helpers.dtype_and_values( - ivy_np.valid_numeric_dtypes, n_arrays=2, allow_inf=False - ), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="floor_divide"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_floor_divide( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - x1 = (np.asarray(x[0], dtype=input_dtype[0]),) - x2 = (np.asarray(x[1], dtype=input_dtype[1]),) - assume(np.all(x2[0] != 0)) - # we assume values aren't too close to the boundaries as tf and torch have issues: - # https://github.com/pytorch/pytorch/issues/77742#issuecomment-1146026178 - # https://github.com/tensorflow/tensorflow/issues/56130 - if fw in ["tensorflow", "torch"]: - if ivy.is_float_dtype(input_dtype[0]): - low1 = 2 * ivy.finfo(input_dtype[0]).smallest_normal - high1 = 0.5 * ivy.finfo(input_dtype[0]).max - assume(np.all(x1[0] > low1) and np.all(x1[0] < high1)) - if ivy.is_float_dtype(input_dtype[1]): - low2 = 2 * ivy.finfo(input_dtype[0]).smallest_normal - high2 = 0.5 * ivy.finfo(input_dtype[1]).max - assume(np.all(x2[0] > low2) and np.all(x2[0] < high2)) - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "floor_divide", - x1=x1[0], - x2=x2[0], - ) - - -# greater -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="greater"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_greater( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "greater", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# greater_equal -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="greater_equal"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_greater_equal( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "greater_equal", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# isfinite -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="isfinite"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_isfinite( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "isfinite", - x=np.asarray(x, dtype=input_dtype), - ) - - -# isinf -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="isinf"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_isinf( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "isinf", - x=np.asarray(x, dtype=input_dtype), - ) - - -# isnan -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="isnan"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_isnan( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "isnan", - x=np.asarray(x, dtype=input_dtype), - ) - - -# less -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="less"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_less( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "less", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# less_equal -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="less_equal"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_less_equal( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "less_equal", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# log -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="log"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_log( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "log", - x=np.asarray(x, dtype=input_dtype), - ) - - -# log1p -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="log1p"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_log1p( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "log1p", - x=np.asarray(x, dtype=input_dtype), - ) - - -# log2 -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="log2"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_log2( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "log2", - x=np.asarray(x, dtype=input_dtype), - ) - - -# log10 -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="log10"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_log10( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "log10", - x=np.asarray(x, dtype=input_dtype), - ) - - -# logaddexp -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="logaddexp"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_logaddexp( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "logaddexp", - test_rtol=1e-2, - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# logical_and -@given( - dtype_and_x=helpers.dtype_and_values(("bool",), 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="logical_and"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_logical_and( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "logical_and", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# logical_not -@given( - dtype_and_x=helpers.dtype_and_values(("bool",)), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="logical_not"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_logical_not( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "logical_not", - x=np.asarray(x, dtype=input_dtype), - ) - - -# logical_or -@given( - dtype_and_x=helpers.dtype_and_values(("bool",), 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="logical_or"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_logical_or( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "logical_or", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# logical_xor -@given( - dtype_and_x=helpers.dtype_and_values(("bool",), 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="logical_xor"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_logical_xor( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "logical_xor", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# multiply -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="multiply"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_multiply( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "multiply", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# negative -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="negative"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_negative( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "negative", - x=np.asarray(x, dtype=input_dtype), - ) - - -# not_equal -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="not_equal"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_not_equal( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "not_equal", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# positive -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="positive"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_positive( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "positive", - x=np.asarray(x, dtype=input_dtype), - ) - - -# pow -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="pow"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_pow( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - x1 = np.asarray(x[0], dtype=input_dtype[0]) - x2 = np.asarray(x[1], dtype=input_dtype[1]) - if fw in ["jax", "tensorflow"]: - return - if ( - np.any(x2 < 0) - and ivy.is_int_dtype(input_dtype[1]) - and ivy.is_int_dtype(input_dtype[0]) - ): - return # ints to negative int powers not allowed - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "pow", - x1=x1, - x2=x2, - ) - - -# remainder -@given( - dtype_and_x=helpers.dtype_and_values( - ivy_np.valid_numeric_dtypes, n_arrays=2, allow_inf=False - ), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="remainder"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_remainder( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - x1 = np.asarray(x[0], dtype=input_dtype[0]) - x2 = np.asarray(x[1], dtype=input_dtype[1]) - assume(not np.any(x2 == 0)) - helpers.test_function( - input_dtype, - [as_variable, False], - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "remainder", - x1=x1, - x2=x2, - ) - - -# round -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="round"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_round( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "round", - x=np.asarray(x, dtype=input_dtype), - ) - - -# sign -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="sign"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_sign( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "sign", - x=np.asarray(x, dtype=input_dtype), - ) - - -# sin -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="sin"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_sin( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "sin", - x=np.asarray(x, dtype=input_dtype), - ) - - -# sinh -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="sinh"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_sinh( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "sinh", - x=np.asarray(x, dtype=input_dtype), - ) - - -# square -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="square"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_square( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "square", - x=np.asarray(x, dtype=input_dtype), - ) - - -# sqrt -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes, allow_inf=False), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="sqrt"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_sqrt( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "sqrt", - x=np.asarray(x, dtype=input_dtype), - ) - - -# subtract -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, 2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="subtract"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_subtract( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "subtract", - x1=np.asarray(x[0], dtype=input_dtype[0]), - x2=np.asarray(x[1], dtype=input_dtype[1]), - ) - - -# tan -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="tan"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_tan( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "tan", - x=np.asarray(x, dtype=input_dtype), - ) - - -# tanh -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="tanh"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_tanh( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "tanh", - x=np.asarray(x, dtype=input_dtype), - ) - - -# trunc -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="trunc"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_trunc( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "trunc", - x=np.asarray(x, dtype=input_dtype), - ) - - -# Extra # -# ------# - - -# erf -@given( - dtype_and_x=helpers.dtype_and_values(ivy_np.valid_float_dtypes), - as_variable=st.booleans(), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="erf"), - native_array=st.booleans(), - container=st.booleans(), - instance_method=st.booleans(), -) -def test_erf( - dtype_and_x, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - input_dtype, x = dtype_and_x - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "erf", - x=np.asarray(x, dtype=input_dtype), - ) - - -# minimum -@given( - xy=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, n_arrays=2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="minimum"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_minimum( - xy, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - # smoke test - input_dtype = xy[0] - x = xy[1][0] - y = xy[1][1] - if ( - (isinstance(xy[1][0], Number) or isinstance(xy[1], Number)) - and as_variable is True - and fw == "mxnet" - ): - # mxnet does not support 0-dimensional variables - return - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "minimum", - x1=np.array(x, dtype=input_dtype[0]), - x2=np.array(y, dtype=input_dtype[1]), - ) - - -# maximum -@given( - xy=helpers.dtype_and_values(ivy_np.valid_numeric_dtypes, n_arrays=2), - as_variable=helpers.list_of_length(st.booleans(), 2), - with_out=st.booleans(), - num_positional_args=helpers.num_positional_args(fn_name="maximum"), - native_array=helpers.list_of_length(st.booleans(), 2), - container=helpers.list_of_length(st.booleans(), 2), - instance_method=st.booleans(), -) -def test_maximum( - xy, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, -): - # smoke test - input_dtype = xy[0] - x = xy[1][0] - y = xy[1][1] - if ( - (isinstance(xy[1][0], Number) or isinstance(xy[1], Number)) - and as_variable is True - and fw == "mxnet" - ): - # mxnet does not support 0-dimensional variables - return - helpers.test_function( - input_dtype, - as_variable, - with_out, - num_positional_args, - native_array, - container, - instance_method, - fw, - "maximum", - x1=np.array(x, dtype=input_dtype[0]), - x2=np.array(y, dtype=input_dtype[1]), - )