cupy.testing.numpy_cupy_array_less#

cupy.testing.numpy_cupy_array_less(err_msg='', verbose=True, name='xp', type_check=True, accept_error=False, sp_name=None, scipy_name=None)[source]#

一个装饰器,检查 CuPy 结果是否小于 NumPy 结果。

参数:
  • err_msg (str) – 失败时打印的错误消息。

  • verbose (bool) – 如果为 True,则将冲突的值附加到错误消息中。

  • name (str) – 参数名称,其值可以是 numpycupy 模块。

  • type_check (bool) – 如果为 True,则还会检查 dtype 的一致性。

  • accept_error (bool, Exceptiontuple of Exception) – 指定可接受的错误。当 NumPy 测试和 CuPy 测试都引发相同类型的错误,并且错误类型由该参数指定时,这些错误将被忽略,不会被引发。如果为 True,则所有错误类型均可接受。如果为 False,则不接受任何错误。

  • sp_name (strNone) – 参数名称,其值可以是 scipy.sparsecupyx.scipy.sparse 模块。如果为 None,则不提供此模块的参数。

  • scipy_name (strNone) – 参数名称,其值可以是 scipycupyx.scipy 模块。如果为 None,则不提供此模块的参数。

装饰的测试 fixture 要求当 xpcupy 时返回的数组应小于当 xpnumpy 时返回的数组。