(self)
| 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) |
nothing calls this directly
no test coverage detected