Skip to content
Snippets Groups Projects
Commit 5eb23249 authored by Gabriele Buondonno's avatar Gabriele Buondonno Committed by Gabriele Buondonno
Browse files

[python] [utils] Fix isApprox for array

parent 1c5baf43
Branches
Tags
No related merge requests found
......@@ -42,6 +42,8 @@ def isapprox(a, b, epsilon=1e-6):
if "np" in b.__class__.__dict__:
b = b.np
if isinstance(a, (np.ndarray, list)) and isinstance(b, (np.ndarray, list)):
a = np.squeeze(np.array(a))
b = np.squeeze(np.array(b))
return np.allclose(a, b, epsilon)
return abs(a - b) < epsilon
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment