@@ -251,7 +251,7 @@ def _make_positive_masks(impl, args, kw, name, sp_name, scipy_name):
251251 assert error is None
252252 if not isinstance (result , (tuple , list )):
253253 result = (result ,)
254- return [r >= 0 for r in result ]
254+ return [cupy . asnumpy ( r ) >= 0 for r in result ]
255255
256256
257257def _contains_signed_and_unsigned (kw ):
@@ -307,12 +307,9 @@ def decorator(impl):
307307 @_wraps_partial_xp (impl , name , sp_name , scipy_name )
308308 def test_func (* args , ** kw ):
309309 # Run cupy and numpy
310- (
311- cupy_result ,
312- cupy_error ,
313- numpy_result ,
314- numpy_error ,
315- ) = _call_func_numpy_cupy (impl , args , kw , name , sp_name , scipy_name )
310+ (cupy_result , cupy_error , numpy_result , numpy_error ) = (
311+ _call_func_numpy_cupy (impl , args , kw , name , sp_name , scipy_name )
312+ )
316313 assert cupy_result is not None or cupy_error is not None
317314 assert numpy_result is not None or numpy_error is not None
318315
@@ -411,8 +408,8 @@ def test_func(*args, **kw):
411408 if cupy_r .shape == ():
412409 skip = (mask == 0 ).all ()
413410 else :
414- cupy_r = cupy_r [mask ]
415- numpy_r = numpy_r [mask . asnumpy () ]
411+ cupy_r = cupy_r [mask ]. asnumpy ()
412+ numpy_r = numpy_r [mask ]
416413
417414 if not skip :
418415 check_func (cupy_r , numpy_r )
@@ -446,7 +443,7 @@ def _convert_output_to_ndarray(c_out, n_out, sp_name, check_sparse_format):
446443 assert scipy .sparse .issparse (n_out )
447444 if check_sparse_format :
448445 assert c_out .format == n_out .format
449- return c_out .A , n_out .A
446+ return c_out .toarray () , n_out .toarray ()
450447 if isinstance (c_out , cupy .ndarray ) and isinstance (
451448 n_out , (numpy .ndarray , numpy .generic )
452449 ):
@@ -455,7 +452,6 @@ def _convert_output_to_ndarray(c_out, n_out, sp_name, check_sparse_format):
455452 if (
456453 hasattr (cupy , "poly1d" )
457454 and isinstance (c_out , cupy .poly1d )
458- and hasattr (numpy , "poly1d" )
459455 and isinstance (n_out , numpy .poly1d )
460456 ):
461457 # poly1d output case.
@@ -464,9 +460,6 @@ def _convert_output_to_ndarray(c_out, n_out, sp_name, check_sparse_format):
464460 if isinstance (c_out , numpy .generic ) and isinstance (n_out , numpy .generic ):
465461 # numpy scalar output case.
466462 return c_out , n_out
467- if isinstance (c_out , numpy .ndarray ) and isinstance (n_out , numpy .ndarray ):
468- # fallback on numpy output case.
469- return c_out , n_out
470463 if numpy .isscalar (c_out ) and numpy .isscalar (n_out ):
471464 # python scalar output case.
472465 return cupy .array (c_out ), numpy .array (n_out )
@@ -594,7 +587,9 @@ def numpy_cupy_allclose(
594587
595588 def check_func (c , n ):
596589 rtol1 , atol1 = _resolve_tolerance (type_check , c , rtol , atol )
597- _array .assert_allclose (c , n , rtol1 , atol1 , err_msg , verbose )
590+ _array .assert_allclose (
591+ c , n , rtol1 , atol1 , err_msg = err_msg , verbose = verbose
592+ )
598593
599594 return _make_decorator (
600595 check_func ,
@@ -795,7 +790,9 @@ def numpy_cupy_array_equal(
795790 """
796791
797792 def check_func (x , y ):
798- _array .assert_array_equal (x , y , err_msg , verbose , strides_check )
793+ _array .assert_array_equal (
794+ x , y , err_msg , verbose , strides_check = strides_check
795+ )
799796
800797 return _make_decorator (
801798 check_func , name , type_check , False , accept_error , sp_name , scipy_name
@@ -905,12 +902,9 @@ def decorator(impl):
905902 @_wraps_partial_xp (impl , name , sp_name , scipy_name )
906903 def test_func (* args , ** kw ):
907904 # Run cupy and numpy
908- (
909- cupy_result ,
910- cupy_error ,
911- numpy_result ,
912- numpy_error ,
913- ) = _call_func_numpy_cupy (impl , args , kw , name , sp_name , scipy_name )
905+ (cupy_result , cupy_error , numpy_result , numpy_error ) = (
906+ _call_func_numpy_cupy (impl , args , kw , name , sp_name , scipy_name )
907+ )
914908
915909 if cupy_error or numpy_error :
916910 _check_cupy_numpy_error (
@@ -964,12 +958,9 @@ def decorator(impl):
964958 @_wraps_partial_xp (impl , name , sp_name , scipy_name )
965959 def test_func (* args , ** kw ):
966960 # Run cupy and numpy
967- (
968- cupy_result ,
969- cupy_error ,
970- numpy_result ,
971- numpy_error ,
972- ) = _call_func_numpy_cupy (impl , args , kw , name , sp_name , scipy_name )
961+ (cupy_result , cupy_error , numpy_result , numpy_error ) = (
962+ _call_func_numpy_cupy (impl , args , kw , name , sp_name , scipy_name )
963+ )
973964
974965 _check_cupy_numpy_error (
975966 cupy_error , numpy_error , accept_error = accept_error
0 commit comments