(ctx, grad_output: torch.Tensor)
| 21 | |
| 22 | @staticmethod |
| 23 | def backward(ctx, grad_output: torch.Tensor): |
| 24 | inp, quant_w, scale_w = ctx.saved_tensors |
| 25 | weight = extract_weight_to_half(quant_w, scale_w, ctx.weight_bit_width) |
| 26 | grad_output = grad_output.contiguous().view(-1, weight.size(0)) |
| 27 | grad_input = grad_output.mm(weight) |
| 28 | grad_weight = grad_output.t().mm(inp) |
| 29 | return grad_input.view(ctx.inp_shape), grad_weight.view(ctx.weight_shape), None |
| 30 | |
| 31 | |
| 32 | class QuantizedLinear(torch.nn.Module): |
nothing calls this directly
no test coverage detected