Assertions#
- ivy_tests.test_ivy.helpers.assertions.assert_all_close(ret_np, ret_from_gt_np, rtol=1e-05, atol=1e-08, ground_truth_backend='TensorFlow')[source]#
Match the ret_np and ret_from_gt_np inputs element-by-element to ensure that they are the same.
- Parameters:
ret_np – Return from the framework to test. Ivy Container or Numpy Array.
ret_from_gt_np – Return from the ground truth framework. Ivy Container or Numpy Array.
rtol – Relative Tolerance Value.
atol – Absolute Tolerance Value.
ground_truth_backend – Ground Truth Backend Framework.
- Returns:
None if the test passes, else marks the test as failed.
- ivy_tests.test_ivy.helpers.assertions.assert_same_type_and_shape(values, this_key_chain=None)[source]#
- ivy_tests.test_ivy.helpers.assertions.check_unsupported_device(*, fn, input_device, all_as_kwargs_np)[source]#
Check whether a function does not support a given device.
- Parameters:
fn – The function to check.
input_device – The backend device.
all_as_kwargs_np – All arguments in Numpy Format, to check for the presence of dtype argument.
- Returns:
True if the function does not support the given device, False otherwise.
- ivy_tests.test_ivy.helpers.assertions.check_unsupported_device_and_dtype(*, fn, device, input_dtypes, all_as_kwargs_np)[source]#
Check whether a function does not support a given device or data types.
- Parameters:
fn – The function to check.
device – The backend device to check.
input_dtypes – data-types of the input arguments and keyword-arguments.
all_as_kwargs_np – All arguments in Numpy Format, to check for the presence of dtype argument.
- Returns:
True if the function does not support both the device and any data type, False
otherwise.
- ivy_tests.test_ivy.helpers.assertions.check_unsupported_dtype(*, fn, input_dtypes, all_as_kwargs_np)[source]#
Check whether a function does not support the input data types or the output data type.
- Parameters:
fn – The function to check.
input_dtypes – data-types of the input arguments and keyword-arguments.
all_as_kwargs_np – All arguments in Numpy Format, to check for the presence of dtype argument.
- Returns:
True if the function does not support the given input or output data types, False
otherwise.
- ivy_tests.test_ivy.helpers.assertions.test_unsupported_function(*, fn, args, kwargs)[source]#
Test a function with an unsupported datatype to raise an exception.
- Parameters:
fn – callable function to test.
args – arguments to the function.
kwargs – keyword-arguments to the function.
- ivy_tests.test_ivy.helpers.assertions.value_test(*, ret_np_flat, ret_np_from_gt_flat, rtol=None, atol=1e-06, ground_truth_backend='TensorFlow')[source]#
Perform a value test for matching the arrays in ret_np_flat and ret_from_np_gt_flat.
- Parameters:
ret_np_flat – A list (flattened) containing Numpy arrays. Return from the framework to test.
ret_np_from_gt_flat – A list (flattened) containing Numpy arrays. Return from the ground truth framework.
rtol – Relative Tolerance Value.
atol – Absolute Tolerance Value.
ground_truth_backend – Ground Truth Backend Framework.
- Returns:
None if the value test passes, else marks the test as failed.