mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 22:30:35 +08:00
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:
committed by
Facebook GitHub Bot
parent
d9f709599b
commit
a6508ac3df
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user