MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS / backward

Method backward

models/quantization.py:286–293  ·  view source on GitHub ↗
(ctx, grad_output)

Source from the content-addressed store, hash-verified

284 @staticmethod
285 @custom_bwd
286 def backward(ctx, grad_output):
287 qweight, scales, qzeros, g_idx = ctx.saved_tensors
288 bits, maxq = ctx.bits, ctx.maxq
289 grad_input = None
290
291 if ctx.needs_input_grad[0]:
292 grad_input = transpose_matmul248(grad_output, qweight, scales, qzeros, g_idx, bits, maxq)
293 return grad_input, None, None, None, None, None, None
294
295class QuantLinear(nn.Module):
296 def __init__(self, bits, groupsize, infeatures, outfeatures, bias):

Callers 1

trainFunction · 0.80

Calls 1

transpose_matmul248Function · 0.85

Tested by

no test coverage detected