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

Class MinkowskiSPMMFunction

MinkowskiEngine/sparse_matrix_functions.py:124–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122
123
124class MinkowskiSPMMFunction(Function):
125 @staticmethod
126 def forward(
127 ctx,
128 rows: torch.Tensor,
129 cols: torch.Tensor,
130 vals: torch.Tensor,
131 size: torch.Size,
132 mat: torch.Tensor,
133 cuda_spmm_alg: int = 1,
134 ):
135 ctx.misc_args = size, cuda_spmm_alg
136 ctx.save_for_backward(rows, cols, vals)
137 result = spmm(
138 rows,
139 cols,
140 vals,
141 size,
142 mat,
143 is_sorted=False,
144 cuda_spmm_alg=cuda_spmm_alg,
145 )
146 return result
147
148 @staticmethod
149 def backward(ctx, grad: torch.Tensor):
150 size, cuda_spmm_alg = ctx.misc_args
151 rows, cols, vals = ctx.saved_tensors
152 new_size = torch.Size([size[1], size[0]])
153 grad = spmm(
154 cols,
155 rows,
156 vals,
157 new_size,
158 grad,
159 is_sorted=False,
160 cuda_spmm_alg=cuda_spmm_alg,
161 )
162 return (
163 None,
164 None,
165 None,
166 None,
167 grad,
168 None,
169 )
170
171
172class MinkowskiSPMMAverageFunction(Function):

Callers 6

sparseMethod · 0.90
splatMethod · 0.90
interpolateMethod · 0.90
testMethod · 0.90
test_dtypeMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_dtypeMethod · 0.72