MCPcopy Create free account
hub / github.com/OpenImagingLab/4DSloMo / backward

Method backward

pointops2/functions/pointops2.py:148–159  ·  view source on GitHub ↗

input: grad_out: (n, c) output: grad_input: (n, c), grad_position: (n, nsample, c), grad_weight : (n, nsample, c')

(ctx, grad_output)

Source from the content-addressed store, hash-verified

146
147 @staticmethod
148 def backward(ctx, grad_output):
149 """
150 input: grad_out: (n, c)
151 output: grad_input: (n, c), grad_position: (n, nsample, c), grad_weight : (n, nsample, c')
152 """
153 input, position, weight, idx = ctx.saved_tensors
154 n, nsample, c = position.shape; w_c = weight.shape[-1]
155 grad_input = torch.cuda.FloatTensor(n, c).zero_()
156 grad_position = torch.cuda.FloatTensor(n, nsample, c).zero_()
157 grad_weight = torch.cuda.FloatTensor(n, nsample, w_c).zero_()
158 pointops_cuda.aggregation_backward_cuda(n, nsample, c, w_c, input, position, weight, idx, grad_output, grad_input, grad_position, grad_weight)
159 return grad_input, grad_position, grad_weight, None
160
161aggregation = Aggregation.apply
162

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected