Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore old is_different #932

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions sacred/config/custom_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,6 @@ def type_changed(old_value, new_value):
def is_different(old_value, new_value):
"""Numpy aware comparison between two values."""
if opt.has_numpy:
# Reproduces np.array_equal from numpy<2
# np.array_equal raises an exception when the arguments are scalar and
# differ in type (e.g. int and str) in numpy>=2.0
try:
old_value = opt.np.asarray(old_value)
new_value = opt.np.asarray(new_value)
except:
return True
else:
result = old_value != new_value
if isinstance(result, bool):
return result
else:
return result.all()

return old_value != new_value
return not opt.np.array_equal(old_value, new_value)
else:
return old_value != new_value
Loading