(self)
| 38 | |
| 39 | class TestStack(unittest.TestCase): |
| 40 | def test_sum(self): |
| 41 | coords, colors, pcd = load_file("1.ply") |
| 42 | device = "cuda" |
| 43 | |
| 44 | D = 3 |
| 45 | batch_size = 16 |
| 46 | voxel_size = 0.02 |
| 47 | channels = [3, 64, 128] |
| 48 | dcoords = torch.from_numpy(np.floor(coords / voxel_size)).int() |
| 49 | bcoords = batched_coordinates([dcoords for i in range(batch_size)]) |
| 50 | in_feats = torch.rand(len(bcoords), 3).to(0) |
| 51 | |
| 52 | layer = MinkowskiStackSum( |
| 53 | ME.MinkowskiConvolution( |
| 54 | channels[0], |
| 55 | channels[1], |
| 56 | kernel_size=3, |
| 57 | stride=1, |
| 58 | dimension=3, |
| 59 | ), |
| 60 | nn.Sequential( |
| 61 | ME.MinkowskiConvolution( |
| 62 | channels[0], |
| 63 | channels[1], |
| 64 | kernel_size=3, |
| 65 | stride=2, |
| 66 | dimension=3, |
| 67 | ), |
| 68 | ME.MinkowskiStackSum( |
| 69 | nn.Identity(), |
| 70 | nn.Sequential( |
| 71 | ME.MinkowskiConvolution( |
| 72 | channels[1], |
| 73 | channels[2], |
| 74 | kernel_size=3, |
| 75 | stride=2, |
| 76 | dimension=3, |
| 77 | ), |
| 78 | ME.MinkowskiConvolutionTranspose( |
| 79 | channels[2], |
| 80 | channels[1], |
| 81 | kernel_size=3, |
| 82 | stride=1, |
| 83 | dimension=3, |
| 84 | ), |
| 85 | ME.MinkowskiPoolingTranspose( |
| 86 | kernel_size=2, stride=2, dimension=D |
| 87 | ), |
| 88 | ), |
| 89 | ), |
| 90 | ME.MinkowskiPoolingTranspose(kernel_size=2, stride=2, dimension=D), |
| 91 | ), |
| 92 | ).cuda() |
| 93 | |
| 94 | for i in range(1000): |
| 95 | torch.cuda.empty_cache() |
| 96 | sinput = ME.SparseTensor(in_feats, coordinates=bcoords, device=device) |
| 97 | layer(sinput) |
nothing calls this directly
no test coverage detected