def test_func(self, *args, **kw): kw[name] = cupy x = impl(self, *args, **kw) kw[name] = numpy y = impl(self, *args, **kw) self.assertIsNotNone(x) self.assertIsNotNone(y) array.assert_allclose(x, y, rtol, atol, err_msg, verbose) if type_check: self.assertEqual(x.dtype, y.dtype)
def check_func(cupy_result, numpy_result): c = cupy_result n = numpy_result array.assert_allclose(c, n, rtol, atol, err_msg, verbose) if contiguous_check and isinstance(n, numpy.ndarray): if n.flags.c_contiguous and not c.flags.c_contiguous: raise AssertionError( 'The state of c_contiguous flag is false. ' '(cupy_result:{} numpy_result:{})'.format( c.flags.c_contiguous, n.flags.c_contiguous)) if n.flags.f_contiguous and not c.flags.f_contiguous: raise AssertionError( 'The state of f_contiguous flag is false. ' '(cupy_result:{} numpy_result:{})'.format( c.flags.f_contiguous, n.flags.f_contiguous))
def check_func(c, n): c_array = c n_array = n if sp_name is not None: import scipy.sparse if cupyx.scipy.sparse.issparse(c): c_array = c.A if scipy.sparse.issparse(n): n_array = n.A array.assert_allclose(c_array, n_array, rtol, atol, err_msg, verbose) if contiguous_check and isinstance(n, numpy.ndarray): if n.flags.c_contiguous and not c.flags.c_contiguous: raise AssertionError( 'The state of c_contiguous flag is false. ' '(cupy_result:{} numpy_result:{})'.format( c.flags.c_contiguous, n.flags.c_contiguous)) if n.flags.f_contiguous and not c.flags.f_contiguous: raise AssertionError( 'The state of f_contiguous flag is false. ' '(cupy_result:{} numpy_result:{})'.format( c.flags.f_contiguous, n.flags.f_contiguous))
def check_func(cupy_result, numpy_result): array.assert_allclose(cupy_result, numpy_result, rtol, atol, err_msg, verbose)
def check_func(c, n): array.assert_allclose(c, n, rtol, atol, err_msg, verbose)
def test_func(self, *args, **kw): kw[name] = cupy x = impl(self, *args, **kw) kw[name] = numpy y = impl(self, *args, **kw) array.assert_allclose(x, y, rtol, atol, err_msg, verbose)