test_pack.py 554 Bytes
Newer Older
1
2
3
4
5
6
import pytest
import torch

device = "cuda:0"


7
@pytest.mark.skipif(not torch.cuda.is_available, reason="No CUDA device")
8
9
def test_pack_info():
    from nerfacc.pack import pack_info
10

11
    _packed_info = torch.tensor(
12
13
        [[0, 1], [1, 0], [1, 4]], dtype=torch.int32, device=device
    )
14
    ray_indices = torch.tensor(
15
16
        [0, 2, 2, 2, 2], dtype=torch.int64, device=device
    )
17
18
    packed_info = pack_info(ray_indices, n_rays=_packed_info.shape[0])
    assert (packed_info == _packed_info).all()
19
20
21


if __name__ == "__main__":
22
    test_pack_info()