MCPcopy Create free account
hub / github.com/cupy/cupy / assert_array_almost_equal

Function assert_array_almost_equal

cupy/testing/_array.py:51–69  ·  view source on GitHub ↗

Raises an AssertionError if objects are not equal up to desired precision. Args: x(numpy.ndarray or cupy.ndarray): The actual object to check. y(numpy.ndarray or cupy.ndarray): The desired, expected object. decimal(int): Desired precision. err_msg(str): The e

(
        actual, desired, decimal=6, err_msg='', verbose=True,
)

Source from the content-addressed store, hash-verified

49
50
51def assert_array_almost_equal(
52 actual, desired, decimal=6, err_msg='', verbose=True,
53):
54 """Raises an AssertionError if objects are not equal up to desired precision.
55
56 Args:
57 x(numpy.ndarray or cupy.ndarray): The actual object to check.
58 y(numpy.ndarray or cupy.ndarray): The desired, expected object.
59 decimal(int): Desired precision.
60 err_msg(str): The error message to be printed in case of failure.
61 verbose(bool): If ``True``, the conflicting
62 values are appended to the error message.
63
64 .. seealso:: :func:`numpy.testing.assert_array_almost_equal`
65 """ # NOQA
66 numpy.testing.assert_array_almost_equal(
67 cupy.asnumpy(actual), cupy.asnumpy(desired), decimal=decimal,
68 err_msg=err_msg, verbose=verbose,
69 )
70
71
72def assert_array_almost_equal_nulp(x, y, nulp=1):

Callers 15

_check_fill_valueMethod · 0.90
_nd_check_interpMethod · 0.90
_nd_check_shapeMethod · 0.90
test_complexMethod · 0.90
test_linear_xi1dMethod · 0.90
test_linear_xi3dMethod · 0.90
test_nearestMethod · 0.90
test_linear_edgesMethod · 0.90
test_linear_4dMethod · 0.90

Calls

no outgoing calls

Tested by 15

_check_fill_valueMethod · 0.72
_nd_check_interpMethod · 0.72
_nd_check_shapeMethod · 0.72
test_complexMethod · 0.72
test_linear_xi1dMethod · 0.72
test_linear_xi3dMethod · 0.72
test_nearestMethod · 0.72
test_linear_edgesMethod · 0.72
test_linear_4dMethod · 0.72