|
12 | 12 | import numpy as np
|
13 | 13 | import torch
|
14 | 14 | from common_testing import TestCaseMixin
|
15 |
| -from pytorch3d.ops import add_pointclouds_to_volumes |
| 15 | +from pytorch3d.ops import ( |
| 16 | + add_pointclouds_to_volumes, |
| 17 | + add_points_features_to_volume_densities_features, |
| 18 | +) |
16 | 19 | from pytorch3d.ops.points_to_volumes import _points_to_volumes
|
17 | 20 | from pytorch3d.ops.sample_points_from_meshes import sample_points_from_meshes
|
18 | 21 | from pytorch3d.structures.meshes import Meshes
|
@@ -373,6 +376,17 @@ def test_from_point_cloud(self, interp_mode="trilinear"):
|
373 | 376 | else:
|
374 | 377 | self.assertTrue(torch.isfinite(field.grad.data).all())
|
375 | 378 |
|
| 379 | + def test_defaulted_arguments(self): |
| 380 | + points = torch.rand(30, 1000, 3) |
| 381 | + features = torch.rand(30, 1000, 5) |
| 382 | + _, densities = add_points_features_to_volume_densities_features( |
| 383 | + points, |
| 384 | + features, |
| 385 | + torch.zeros(30, 1, 32, 32, 32), |
| 386 | + torch.zeros(30, 5, 32, 32, 32), |
| 387 | + ) |
| 388 | + self.assertClose(torch.sum(densities), torch.tensor(30 * 1000.0), atol=0.1) |
| 389 | + |
376 | 390 | def _check_volume_slice_color_density(
|
377 | 391 | self, V, split_dim, interp_mode, clr_gt, slice_type, border=3
|
378 | 392 | ):
|
|
0 commit comments