Skip to content

Commit

Permalink
Fix a strange bug in norm operation (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
PENG Zhenghao committed Apr 18, 2021
1 parent 87aa5f5 commit eb8aaaf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pgdrive/tests/test_component/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def _test_cutils(cutils):
for _ in range(20):
pos = np.random.normal(1000, 1000, size=(2, ))
n = cutils.cutils_norm(*pos.tolist())
assert n == np.linalg.norm(pos)
assert n == np.linalg.norm(pos, ord=2)

clip0 = cutils.cutils_clip(pos[0], 999, 1001)
clip1 = cutils.cutils_clip(pos[1], 999, 1001)
Expand Down Expand Up @@ -41,7 +41,7 @@ def test_utils():

for _ in range(20):
pos = np.random.normal(0, 1, size=(2, ))
assert distance_greater(pos, (0, 0), 0.5) == (np.linalg.norm(pos) > 0.5)
assert distance_greater(pos, (0, 0), 0.5) == (np.linalg.norm(pos, ord=2) > 0.5)


if __name__ == '__main__':
Expand Down

0 comments on commit eb8aaaf

Please sign in to comment.