Skip to content
Snippets Groups Projects
Commit b1ba2c0a authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Fix to skipUnchanged - np.all(a == b) might return true even if a and b have

different shapes
parent f4320ed1
No related branches found
No related tags found
No related merge requests found
...@@ -143,8 +143,13 @@ def skipUnchanged(func): ...@@ -143,8 +143,13 @@ def skipUnchanged(func):
newIsArray = isinstance(value, np.ndarray) newIsArray = isinstance(value, np.ndarray)
isarray = oldIsArray or newIsArray isarray = oldIsArray or newIsArray
if isarray: nochange = np.all(oldVal == value) if isarray:
else: nochange = oldVal == value a = np.array(oldVal, copy=False)
b = np.array(value, copy=False)
nochange = (a.shape == b.shape) and np.allclose(a, b)
else:
nochange = oldVal == value
if nochange: if nochange:
return False return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment