(self)
| 102 | self.assertTrue(len(mapping) == len(qcoords)) |
| 103 | |
| 104 | def test_collision(self): |
| 105 | coords = np.array([[0, 0], [0, 0], [0, 0], [0, 1]], dtype=np.int32) |
| 106 | labels = np.array([0, 1, 2, 3], dtype=np.int32) |
| 107 | |
| 108 | unique_coords, colabels = sparse_quantize( |
| 109 | coords, labels=labels, ignore_label=255 |
| 110 | ) |
| 111 | self.assertTrue(len(unique_coords) == 2) |
| 112 | self.assertTrue(torch.IntTensor([0, 0]) in unique_coords) |
| 113 | self.assertTrue(torch.IntTensor([0, 1]) in unique_coords) |
| 114 | self.assertTrue(len(colabels) == 2) |
| 115 | |
| 116 | coords = np.array([[0, 0], [0, 1]], dtype=np.int32) |
| 117 | discrete_coords = sparse_quantize(coords) |
| 118 | self.assertTrue((discrete_coords == unique_coords).all()) |
| 119 | discrete_coords = sparse_quantize(torch.from_numpy(coords)) |
| 120 | self.assertTrue((discrete_coords == unique_coords).all()) |
| 121 | |
| 122 | def test_quantization_size(self): |
| 123 | coords = torch.randn((1000, 3), dtype=torch.float) |
nothing calls this directly
no test coverage detected