Skip to content

Commit

Permalink
add shape check and default to True if an exception is raised (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
n-gao authored Oct 17, 2024
1 parent 0e28284 commit d728e32
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit d728e32

Please sign in to comment.