Fix: Pointclouds.inside_box reducing over spatial dimensions.

Summary: As subj. Tests corrected accordingly. Also changed the test to provide a bit better diagnostics.

Reviewed By: bottler

Differential Revision: D32879498

fbshipit-source-id: 0a852e4a13dcb4ca3e54d71c6b263c5d2eeaf4eb
This commit is contained in:
Roman Shapovalov
2021-12-06 07:44:14 -08:00
committed by Facebook GitHub Bot
parent d9f709599b
commit a6508ac3df
3 changed files with 19 additions and 8 deletions

View File

@@ -163,8 +163,17 @@ class TestCaseMixin(unittest.TestCase):
if close:
return
diff = backend.abs(input + 0.0 - other)
ratio = diff / backend.abs(other)
# handle bool case
if backend == torch and input.dtype == torch.bool:
diff = (input != other).float()
ratio = diff
if backend == np and input.dtype == bool:
diff = (input != other).astype(float)
ratio = diff
else:
diff = backend.abs(input + 0.0 - other)
ratio = diff / backend.abs(other)
try_relative = (diff <= atol) | (backend.isfinite(ratio) & (ratio > 0))
if try_relative.all():
if backend == np: