@@ -440,7 +440,7 @@ def equivalent(x, y, /, loose=False):
440
440
441
441
if loose :
442
442
if np .issubdtype (dt , np .complexfloating ):
443
- return equivalent (x .real , y .real ) & equivalent (x .imag , y .imag )
443
+ return equivalent (x .real , y .real , loose = True ) & equivalent (x .imag , y .imag , loose = True )
444
444
445
445
# TODO: Rec array handling
446
446
return (x == y ) | ((x != x ) & (y != y ))
@@ -559,7 +559,7 @@ def check_fill_value(x, /, *, accept_fv=None) -> None:
559
559
raise ValueError (f"{ x .fill_value = } but should be in { accept_fv } ." )
560
560
561
561
562
- def check_zero_fill_value (* args ):
562
+ def check_zero_fill_value (* args , loose = True ):
563
563
"""
564
564
Checks if all the arguments have zero fill-values.
565
565
@@ -588,7 +588,7 @@ def check_zero_fill_value(*args):
588
588
ValueError: This operation requires zero fill values, but argument 1 had a fill value of 0.5.
589
589
"""
590
590
for i , arg in enumerate (args ):
591
- if hasattr (arg , "fill_value" ) and not equivalent (arg .fill_value , _zero_of_dtype (arg .dtype )):
591
+ if hasattr (arg , "fill_value" ) and not equivalent (arg .fill_value , _zero_of_dtype (arg .dtype ), loose = loose ):
592
592
raise ValueError (
593
593
f"This operation requires zero fill values, but argument { i :d} had a fill value of { arg .fill_value !s} ."
594
594
)
0 commit comments