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

Method test_pcd2

tests/cpp/convolution_cpu_test.py:133–181  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

131 print(f"{batch_size}\t{voxel_size}\t{manager.size(in_key)}\t{min_time}")
132
133 def test_pcd2(self):
134 IC, OC = 3, 16
135 coords, colors, pcd = load_file("1.ply")
136 kernel_size = [3, 3, 3]
137 kernel_stride = [2, 2, 2]
138 kernel_dilation = [1, 1, 1]
139
140 for IC in [3, 8, 16, 32, 64, 128]:
141 for OC in [16, 32, 64, 128, 256]:
142 # size, in, out
143 kernel = torch.rand(np.prod(kernel_size), IC, OC)
144 for batch_size in [1]:
145 for voxel_size in [0.02]:
146
147 min_time = 100000
148
149 dcoords = torch.from_numpy(np.floor(coords / voxel_size)).int()
150 bcoords = batched_coordinates(
151 [dcoords for i in range(batch_size)]
152 )
153
154 for i in range(10):
155 manager = _C.CoordinateMapManager()
156
157 # batch insert
158 in_key, (unique_map, inverse_map) = manager.insert_and_map(
159 bcoords, [1, 1, 1], ""
160 )
161 in_feats = torch.rand(manager.size(in_key), IC)
162 out_key = _C.CoordinateMapKey(4)
163
164 stime = time.time()
165 out_features = _C.ConvolutionForwardCPU(
166 in_feats,
167 kernel,
168 kernel_size,
169 kernel_stride,
170 kernel_dilation,
171 _C.RegionType.HYPER_CUBE,
172 torch.IntTensor(),
173 in_key,
174 out_key,
175 manager,
176 )
177 min_time = min(time.time() - stime, min_time)
178
179 print(
180 f"{batch_size}\t{manager.size(in_key)}\t{manager.size(out_key)}\t{IC}\t{OC}\t{min_time}"
181 )

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.95
load_fileFunction · 0.90
batched_coordinatesFunction · 0.90
CoordinateMapManagerMethod · 0.80
CoordinateMapKeyMethod · 0.80
insert_and_mapMethod · 0.45

Tested by

no test coverage detected