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

Method test_dtype

tests/python/spmm.py:123–144  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

121 self.assertTrue(gradcheck(spmm_fn, (rows, cols, size, mat)))
122
123 def test_dtype(self):
124 rows = torch.Tensor([0, 0, 1, 1]).float()
125 cols = torch.Tensor([0, 1, 2, 3]).double()
126 vals = torch.ones(4).double()
127 size = [2, 4]
128 mat = torch.rand(4, 3).double()
129 mat.requires_grad_()
130 spmm_fn = MinkowskiSPMMFunction()
131 out = spmm_fn.apply(rows, cols, vals, size, mat)
132 print(out)
133
134 if not torch.cuda.is_available():
135 return
136
137 rows = torch.cuda.IntTensor([0, 0, 1, 1])
138 cols = torch.cuda.IntTensor([0, 1, 2, 3])
139 vals = torch.ones(4).double().to(0)
140 size = [2, 4]
141 mat = mat.to(0)
142 mat.requires_grad_()
143 out = spmm_fn.apply(rows, cols, vals, size, mat)
144 print(out)

Callers

nothing calls this directly

Calls 4

floatMethod · 0.80
doubleMethod · 0.80
requires_grad_Method · 0.80

Tested by

no test coverage detected