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

Method test_gpu

tests/python/chwise_conv.py:74–98  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

72 print(input.F.grad)
73
74 def test_gpu(self):
75 print(f"{self.__class__.__name__}: test_gpu")
76 if not torch.cuda.is_available():
77 return
78
79 device = torch.device('cuda')
80 in_channels, D = 3, 2
81 coords, feats, labels = data_loader(in_channels, batch_size=2)
82
83 # Create random coordinates with tensor stride == 2
84 out_coords, tensor_stride = get_random_coords()
85
86 feats = feats.double()
87 feats.requires_grad_()
88 input = SparseTensor(feats, coords=coords).to(device)
89 conv = MinkowskiChannelwiseConvolution(
90 in_channels,
91 kernel_size=3,
92 stride=1,
93 has_bias=False,
94 dimension=D).double().to(device)
95
96 print('Initial input: ', input)
97 output = conv(input)
98 print('Conv output: ', output)
99
100
101if __name__ == '__main__':

Callers

nothing calls this directly

Calls 8

data_loaderFunction · 0.90
SparseTensorClass · 0.90
convFunction · 0.85
deviceMethod · 0.80
doubleMethod · 0.80
requires_grad_Method · 0.80
get_random_coordsFunction · 0.70

Tested by

no test coverage detected