Skip to content

Commit 2c3c284

Browse files
author
Hexu Zhao
committed
fix test_serialization.py
Signed-off-by: Hexu Zhao <hexuz@nvidia.com>
1 parent bd7441d commit 2c3c284

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

tests/unit/test_serialization.py

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from fvdb import GridBatch, JaggedTensor
1010
from fvdb.utils.tests import dtype_to_atol
11-
from fvdb.utils.tests.grid_utils import create_test_grid_batch
11+
from fvdb.utils.tests.grid_utils import make_grid_batch_and_jagged_point_data
1212

1313
all_device_dtype_combos = [
1414
["cuda", torch.float16],
@@ -28,15 +28,11 @@ def setUp(self):
2828
def test_morton_permutation(self, device, dtype):
2929
"""Test Morton order permutations (xyz and zyx variants)."""
3030
# Create a test grid batch with known active voxels
31-
batch_size = 2
32-
grid_size = 8
33-
3431
# Create a grid batch with some active voxels
35-
grid_batch = create_test_grid_batch(
36-
batch_size=batch_size,
37-
grid_size=grid_size,
32+
grid_batch, _, _ = make_grid_batch_and_jagged_point_data(
3833
device=device,
39-
density=0.3 # 30% of voxels will be active
34+
dtype=dtype,
35+
include_boundary_points=True
4036
)
4137

4238
# Get permutation indices for both Morton orderings
@@ -77,15 +73,11 @@ def test_morton_permutation(self, device, dtype):
7773
def test_hilbert_permutation(self, device, dtype):
7874
"""Test Hilbert curve permutations (xyz and zyx variants)."""
7975
# Create a test grid batch with known active voxels
80-
batch_size = 2
81-
grid_size = 8
82-
8376
# Create a grid batch with some active voxels
84-
grid_batch = create_test_grid_batch(
85-
batch_size=batch_size,
86-
grid_size=grid_size,
77+
grid_batch, _, _ = make_grid_batch_and_jagged_point_data(
8778
device=device,
88-
density=0.3 # 30% of voxels will be active
79+
dtype=dtype,
80+
include_boundary_points=True
8981
)
9082

9183
# Get permutation indices for both Hilbert orderings
@@ -125,17 +117,12 @@ def test_hilbert_permutation(self, device, dtype):
125117
@parameterized.expand(all_device_dtype_combos)
126118
def test_permutation_validity(self, device, dtype):
127119
"""Test that permutation indices are valid (complete and unique)."""
128-
batch_size = 3
129-
grid_size = 16
130-
131-
# Create grid batch with varying densities
132-
densities = [0.1, 0.5, 0.8] # Test different sparsity levels
133-
for density in densities:
134-
grid_batch = create_test_grid_batch(
135-
batch_size=batch_size,
136-
grid_size=grid_size,
120+
# Create multiple grid batches to test different configurations
121+
for _ in range(3):
122+
grid_batch, _, _ = make_grid_batch_and_jagged_point_data(
137123
device=device,
138-
density=density
124+
dtype=dtype,
125+
include_boundary_points=True
139126
)
140127

141128
# Test all permutation types

0 commit comments

Comments
 (0)