MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / test_isect

Function test_isect

tests/test_basic.py:443–472  ·  view source on GitHub ↗
(test_data)

Source from the content-addressed store, hash-verified

441
442@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")
443def test_isect(test_data):
444 from gsplat.cuda._torch_impl import _isect_offset_encode, _isect_tiles
445 from gsplat.cuda._wrapper import isect_offset_encode, isect_tiles
446
447 torch.manual_seed(42)
448
449 C, N = 3, 1000
450 width, height = 40, 60
451 means2d = torch.randn(C, N, 2, device=device) * width
452 radii = torch.randint(0, width, (C, N), device=device, dtype=torch.int32)
453 depths = torch.rand(C, N, device=device)
454
455 tile_size = 16
456 tile_width = math.ceil(width / tile_size)
457 tile_height = math.ceil(height / tile_size)
458
459 tiles_per_gauss, isect_ids, flatten_ids = isect_tiles(
460 means2d, radii, depths, tile_size, tile_width, tile_height
461 )
462 isect_offsets = isect_offset_encode(isect_ids, C, tile_width, tile_height)
463
464 _tiles_per_gauss, _isect_ids, _gauss_ids = _isect_tiles(
465 means2d, radii, depths, tile_size, tile_width, tile_height
466 )
467 _isect_offsets = _isect_offset_encode(_isect_ids, C, tile_width, tile_height)
468
469 torch.testing.assert_close(tiles_per_gauss, _tiles_per_gauss)
470 torch.testing.assert_close(isect_ids, _isect_ids)
471 torch.testing.assert_close(flatten_ids, _gauss_ids)
472 torch.testing.assert_close(isect_offsets, _isect_offsets)
473
474
475@pytest.mark.skipif(not torch.cuda.is_available(), reason="No CUDA device")

Callers

nothing calls this directly

Calls 4

isect_tilesFunction · 0.90
isect_offset_encodeFunction · 0.90
_isect_tilesFunction · 0.90
_isect_offset_encodeFunction · 0.90

Tested by

no test coverage detected