MCPcopy Create free account
hub / github.com/NVIDIA/MinkowskiEngine / test_mapping

Method test_mapping

tests/python/quantization.py:68–84  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

66 print(len(unique_map))
67
68 def test_mapping(self):
69 N = 16575
70 coords = (np.random.rand(N, 3) * 100).astype(np.int32)
71 mapping, inverse_mapping = MEB.quantize_np(coords)
72 print("N unique:", len(mapping), "N:", N)
73 self.assertTrue((coords == coords[mapping][inverse_mapping]).all())
74 self.assertTrue((coords == coords[mapping[inverse_mapping]]).all())
75
76 coords = torch.from_numpy(coords)
77 mapping, inverse_mapping = MEB.quantize_th(coords)
78 print("N unique:", len(mapping), "N:", N)
79 self.assertTrue((coords == coords[mapping[inverse_mapping]]).all())
80
81 unique_coords, index, reverse_index = sparse_quantize(
82 coords, return_index=True, return_inverse=True
83 )
84 self.assertTrue((coords == coords[index[reverse_index]]).all())
85
86 def test_label(self):
87 N = 16575

Callers

nothing calls this directly

Calls 1

sparse_quantizeFunction · 0.90

Tested by

no test coverage detected