Пример #1
0
 def test_unbatched_pointcloud_to_spc(self, typed_pointcloud, level,
                                      expected_octree):
     output_spc = unbatched_pointcloud_to_spc(typed_pointcloud, level)
     assert check_spc_octrees(output_spc.octrees,
                              output_spc.lengths,
                              batch_size=output_spc.batch_size,
                              level=level,
                              device=typed_pointcloud.device.type)
     assert torch.equal(output_spc.octrees, expected_octree)
Пример #2
0
def test_random_spc_octree(batch_size, level, device):
    octrees, lengths = random_spc_octrees(batch_size, level, device)
    check_spc_octrees(octrees, lengths, batch_size, level, device)
Пример #3
0
 def test_spc_wrong_level(self, octrees, lengths, wrong_level):
     with pytest.raises(ValueError,
                        match='octree 0 ends at level 3, should end at 4'):
         testing.check_spc_octrees(octrees, lengths, level=wrong_level)
Пример #4
0
 def test_spc_wrong_batch_size(self, octrees, lengths, wrong_batch_size):
     with pytest.raises(ValueError,
                        match=r'lengths is of shape torch.Size\(\[2\]\), '
                              'but batch_size should be 3'):
         testing.check_spc_octrees(octrees, lengths, batch_size=wrong_batch_size)
Пример #5
0
 def test_spc_wrong_lengths(self, octrees, wrong_lengths):
     with pytest.raises(ValueError,
                        match='lengths at 0 is 3, but level 3 ends at length 4'):
         testing.check_spc_octrees(octrees, wrong_lengths)
Пример #6
0
 def test_spc_wrong_device(self, octrees, lengths, wrong_device):
     with pytest.raises(ValueError,
                        match='octrees is on cuda:0, should be on cpu'):
         testing.check_spc_octrees(octrees, lengths, device=wrong_device)
Пример #7
0
 def test_spc_default_success(self, octrees, lengths):
     assert testing.check_spc_octrees(octrees, lengths)
Пример #8
0
 def test_spc_success(self, octrees, lengths, batch_size, level, device):
     assert testing.check_spc_octrees(octrees, lengths, batch_size, level, device)