(self)
| 86 | print(in_feat_grad, kernel_grad) |
| 87 | |
| 88 | def test_pcd(self): |
| 89 | IC, OC = 3, 16 |
| 90 | coords, colors, pcd = load_file("1.ply") |
| 91 | kernel_size = [3, 3, 3] |
| 92 | kernel_stride = [2, 2, 2] |
| 93 | kernel_dilation = [1, 1, 1] |
| 94 | |
| 95 | # size, in, out |
| 96 | kernel = torch.rand(np.prod(kernel_size), IC, OC).to(0) |
| 97 | |
| 98 | for batch_size in [1, 5, 10, 20, 40]: |
| 99 | for voxel_size in [0.05, 0.035, 0.02]: |
| 100 | min_time = 100000 |
| 101 | |
| 102 | dcoords = torch.from_numpy(np.floor(coords / voxel_size)).int() |
| 103 | bcoords = batched_coordinates([dcoords for i in range(batch_size)]) |
| 104 | |
| 105 | for i in range(10): |
| 106 | manager = _C.CoordinateMapManager() |
| 107 | |
| 108 | # batch insert |
| 109 | in_key, (unique_map, inverse_map) = manager.insert_and_map( |
| 110 | bcoords.to(0), [1, 1, 1], "" |
| 111 | ) |
| 112 | in_feats = torch.rand(manager.size(in_key), IC).to(0) |
| 113 | out_key = _C.CoordinateMapKey(4) |
| 114 | |
| 115 | stime = time.time() |
| 116 | out_features = _C.ConvolutionForwardGPU( |
| 117 | in_feats, |
| 118 | kernel, |
| 119 | kernel_size, |
| 120 | kernel_stride, |
| 121 | kernel_dilation, |
| 122 | _C.RegionType.HYPER_CUBE, |
| 123 | torch.IntTensor(), |
| 124 | in_key, |
| 125 | out_key, |
| 126 | manager, |
| 127 | ) |
| 128 | min_time = min(time.time() - stime, min_time) |
| 129 | |
| 130 | print( |
| 131 | f"{batch_size}\t{manager.size(in_key)}\t{manager.size(out_key)}\t{min_time}" |
| 132 | ) |
| 133 | |
| 134 | def test_pcd2(self): |
| 135 | IC, OC = 128, 128 |
nothing calls this directly
no test coverage detected