(self)
| 109 | self.assertEqual(sparse_tensor.F.size(1), 6) |
| 110 | |
| 111 | def test_network(self): |
| 112 | dense_tensor = torch.rand(3, 4, 11, 11, 11, 11) # BxCxD1xD2x....xDN |
| 113 | dense_tensor.requires_grad = True |
| 114 | |
| 115 | # Since the shape is fixed, cache the coordinates for faster inference |
| 116 | coordinates = dense_coordinates(dense_tensor.shape) |
| 117 | |
| 118 | network = nn.Sequential( |
| 119 | # Add layers that can be applied on a regular pytorch tensor |
| 120 | nn.ReLU(), |
| 121 | MinkowskiToSparseTensor(remove_zeros=False, coordinates=coordinates), |
| 122 | MinkowskiConvolution(4, 5, stride=2, kernel_size=3, dimension=4), |
| 123 | MinkowskiBatchNorm(5), |
| 124 | MinkowskiReLU(), |
| 125 | MinkowskiConvolutionTranspose(5, 6, stride=2, kernel_size=3, dimension=4), |
| 126 | MinkowskiToDenseTensor( |
| 127 | dense_tensor.shape |
| 128 | ), # must have the same tensor stride. |
| 129 | ) |
| 130 | |
| 131 | for i in range(5): |
| 132 | print(f"Iteration: {i}") |
| 133 | output = network(dense_tensor) |
| 134 | output.sum().backward() |
| 135 | |
| 136 | assert dense_tensor.grad is not None |
nothing calls this directly
no test coverage detected