mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-22 23:30:35 +08:00
Farthest point sampling python naive
Summary: This is a naive python implementation of the iterative farthest point sampling algorithm along with associated simple tests. The C++/CUDA implementations will follow in subsequent diffs. The algorithm is used to subsample a pointcloud with better coverage of the space of the pointcloud. The function has not been added to `__init__.py`. I will add this after the full C++/CUDA implementations. Reviewed By: jcjohnson Differential Revision: D30285716 fbshipit-source-id: 33f4181041fc652776406bcfd67800a6f0c3dd58
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a0d76a7080
commit
3b7d78c7a7
@@ -76,3 +76,13 @@ class TestOpsUtils(TestCaseMixin, unittest.TestCase):
|
||||
mean = oputil.wmean(x, dim=(0, 1), weight=weight, keepdim=False)
|
||||
mean_gt = np.average(x_np, axis=(0, 1), weights=weight_np)
|
||||
self.assertClose(mean.cpu().data.numpy(), mean_gt)
|
||||
|
||||
def test_masked_gather_errors(self):
|
||||
idx = torch.randint(0, 10, size=(5, 10, 4, 2))
|
||||
points = torch.randn(size=(5, 10, 3))
|
||||
with self.assertRaisesRegex(ValueError, "format is not supported"):
|
||||
oputil.masked_gather(points, idx)
|
||||
|
||||
points = torch.randn(size=(2, 10, 3))
|
||||
with self.assertRaisesRegex(ValueError, "same batch dimension"):
|
||||
oputil.masked_gather(points, idx)
|
||||
|
||||
Reference in New Issue
Block a user