示例#1
0
 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)
示例#2
0
文件: helper.py 项目: takiyu/chainer
 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)
示例#3
0
 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))
示例#4
0
文件: helper.py 项目: espg/cupy
 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))
示例#5
0
文件: helper.py 项目: bittnt/chainer
 def check_func(cupy_result, numpy_result):
     array.assert_allclose(cupy_result, numpy_result,
                           rtol, atol, err_msg, verbose)
示例#6
0
 def check_func(cupy_result, numpy_result):
     array.assert_allclose(cupy_result, numpy_result, rtol, atol, err_msg,
                           verbose)
示例#7
0
 def check_func(c, n):
     array.assert_allclose(c, n, rtol, atol, err_msg, verbose)
示例#8
0
 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)