Skip to content

Commit d728e32

Browse files
authored
add shape check and default to True if an exception is raised (#933)
1 parent 0e28284 commit d728e32

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sacred/config/custom_containers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,14 @@ def is_different(old_value, new_value):
306306
try:
307307
old_value = opt.np.asarray(old_value)
308308
new_value = opt.np.asarray(new_value)
309-
except:
310-
return True
311-
else:
309+
if old_value.shape != new_value.shape:
310+
return True
312311
result = old_value != new_value
313312
if isinstance(result, bool):
314313
return result
315314
else:
316315
return result.all()
316+
except: # if anything goes wrong, it is not equal
317+
return True
317318

318319
return old_value != new_value

0 commit comments

Comments
 (0)