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

Method test_kernelmap

tests/python/kernel_map.py:80–109  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

78 self.assertTrue(sum(len(in_map[0]) for k, in_map in kernel_maps.items()) == 16)
79
80 def test_kernelmap(self):
81 print(f"{self.__class__.__name__}: test_kernelmap")
82 in_channels, out_channels, D = 2, 3, 2
83 coords, feats, labels = data_loader(in_channels)
84 feats = feats.double()
85 feats.requires_grad_()
86 input = SparseTensor(feats, coordinates=coords)
87
88 # Initialize context
89 conv = MinkowskiConvolution(
90 in_channels,
91 out_channels,
92 kernel_size=3,
93 stride=2,
94 bias=True,
95 dimension=D,
96 ).double()
97 output = conv(input)
98
99 iC = input.C.numpy()
100 oC = output.C.numpy()
101 print(iC)
102 print(oC)
103 kernel_maps = output.coordinate_manager.kernel_map(
104 1, 2, stride=2, kernel_size=3
105 )
106 for kernel_index, in_out_map in kernel_maps.items():
107 for i, o in zip(in_out_map[0], in_out_map[1]):
108 print(kernel_index, iC[i], "->", oC[o])
109 self.assertTrue(sum(len(in_map[0]) for k, in_map in kernel_maps.items()) == 16)

Callers

nothing calls this directly

Calls 7

data_loaderFunction · 0.90
SparseTensorClass · 0.90
convFunction · 0.85
doubleMethod · 0.80
requires_grad_Method · 0.80
kernel_mapMethod · 0.45

Tested by

no test coverage detected