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

add shape check and default to True if an exception is raised in is_different #933

Merged
merged 1 commit into from
Oct 17, 2024
Merged
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
7 changes: 4 additions & 3 deletions sacred/config/custom_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,14 @@ def is_different(old_value, new_value):
try:
old_value = opt.np.asarray(old_value)
new_value = opt.np.asarray(new_value)
except:
return True
else:
if old_value.shape != new_value.shape:
return True
result = old_value != new_value
if isinstance(result, bool):
return result
else:
return result.all()
except: # if anything goes wrong, it is not equal
return True

return old_value != new_value
Loading