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

Method test_pcd2

tests/cpp/convolution_gpu_test.py:134–182  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

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