(self)
| 50 | |
| 51 | class TestConvolution(unittest.TestCase): |
| 52 | def test_expansion(self): |
| 53 | print(f"{self.__class__.__name__}: test_expansion") |
| 54 | in_channels, out_channels, D = 2, 2, 2 |
| 55 | coords, feats, labels = data_loader(in_channels) |
| 56 | feats = feats.double() |
| 57 | feats.requires_grad_() |
| 58 | |
| 59 | # Initialize context |
| 60 | conv = MinkowskiConvolution( |
| 61 | in_channels, |
| 62 | out_channels, |
| 63 | kernel_size=3, |
| 64 | stride=2, |
| 65 | bias=False, |
| 66 | expand_coordinates=True, |
| 67 | dimension=D, |
| 68 | ).double() |
| 69 | |
| 70 | input = SparseTensor( |
| 71 | feats, |
| 72 | coordinates=coords, |
| 73 | minkowski_algorithm=MinkowskiAlgorithm.SPEED_OPTIMIZED, |
| 74 | ) |
| 75 | print(input) |
| 76 | output = conv(input) |
| 77 | print(output) |
| 78 | if not torch.cuda.is_available(): |
| 79 | return |
| 80 | |
| 81 | input = SparseTensor( |
| 82 | feats, |
| 83 | coordinates=coords, |
| 84 | minkowski_algorithm=MinkowskiAlgorithm.SPEED_OPTIMIZED, |
| 85 | device="cuda", |
| 86 | ) |
| 87 | conv = conv.to("cuda") |
| 88 | print(input) |
| 89 | output = conv(input) |
| 90 | print(output) |
| 91 | |
| 92 | def test_kernel_map(self): |
| 93 | print(f"{self.__class__.__name__}: test_gpu") |
nothing calls this directly
no test coverage detected