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

Method test_gpu

tests/python/interpolation.py:87–130  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

85 output.sum().backward()
86
87 def test_gpu(self):
88 in_channels, D = 2, 2
89 coords, feats, labels = data_loader(in_channels, batch_size=2)
90 feats = feats.double()
91 tfield = torch.cuda.DoubleTensor(
92 [
93 [0, 0.1, 2.7],
94 [0, 0.3, 2],
95 [1, 1.5, 2.5],
96 ],
97 )
98 feats.requires_grad_()
99 input = SparseTensor(feats, coordinates=coords, device="cuda")
100 interp = MinkowskiInterpolation()
101 output = interp(input, tfield)
102 print(input)
103 print(output)
104
105 output.sum().backward()
106 # Check backward
107 fn = MinkowskiInterpolationFunction()
108 self.assertTrue(
109 gradcheck(
110 fn,
111 (
112 input.F,
113 tfield,
114 input.coordinate_map_key,
115 input._manager,
116 ),
117 )
118 )
119
120 for i in range(LEAK_TEST_ITER):
121 input = SparseTensor(feats, coordinates=coords, device="cuda")
122 tfield = torch.cuda.DoubleTensor(
123 [
124 [0, 0.1, 2.7],
125 [0, 0.3, 2],
126 [1, 1.5, 2.5],
127 ],
128 )
129 output = interp(input, tfield)
130 output.sum().backward()
131
132 def test_strided_tensor(self):
133 in_channels, D = 2, 2

Callers

nothing calls this directly

Calls 8

data_loaderFunction · 0.90
SparseTensorClass · 0.90
gradcheckFunction · 0.90
doubleMethod · 0.80
requires_grad_Method · 0.80
backwardMethod · 0.45

Tested by

no test coverage detected