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

Method test_backward

tests/cpp/convolution_cpu_test.py:43–84  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 print(in_features, out_features)
42
43 def test_backward(self):
44 IC, OC = 3, 5
45 coordinates = torch.IntTensor([[0, 1, -1], [0, 2, 1]])
46 in_features = torch.rand(len(coordinates), IC)
47
48 manager = _C.CoordinateMapManager()
49 in_key, unique_inverse_map = manager.insert_and_map(coordinates, [1, 1], "")
50 kernel_size = [3, 3]
51 kernel_stride = [2, 2]
52 kernel_dilation = [1, 1]
53 out_key = _C.CoordinateMapKey(3)
54
55 # size, in, out
56 kernel = torch.rand(9, IC, OC)
57
58 out_features = _C.ConvolutionForwardCPU(
59 in_features,
60 kernel,
61 kernel_size,
62 kernel_stride,
63 kernel_dilation,
64 _C.RegionType.HYPER_CUBE,
65 torch.IntTensor(),
66 in_key,
67 out_key,
68 manager,
69 )
70
71 out_feat_grad = torch.rand_like(out_features)
72 in_feat_grad, kernel_grad = _C.ConvolutionBackwardCPU(
73 in_features,
74 out_feat_grad,
75 kernel,
76 kernel_size,
77 kernel_stride,
78 kernel_dilation,
79 _C.RegionType.HYPER_CUBE,
80 torch.IntTensor(),
81 in_key,
82 out_key,
83 manager,
84 )
85
86 def test_pcd(self):
87 IC, OC = 3, 16

Callers

nothing calls this directly

Calls 3

CoordinateMapManagerMethod · 0.80
CoordinateMapKeyMethod · 0.80
insert_and_mapMethod · 0.45

Tested by

no test coverage detected