(ctx, grad_output: torch.Tensor)
| 90 | |
| 91 | @staticmethod |
| 92 | def backward(ctx, grad_output: torch.Tensor): |
| 93 | inp, quant_w, scale_w = ctx.saved_tensors |
| 94 | weight = extract_weight_to_half(quant_w, scale_w, ctx.weight_bit_width) |
| 95 | grad_output = grad_output.contiguous().view(-1, weight.size(0)) |
| 96 | grad_input = grad_output.mm(weight) |
| 97 | grad_weight = grad_output.t().mm(inp) |
| 98 | return grad_input.view(ctx.inp_shape), grad_weight.view(ctx.weight_shape), None, None |
| 99 | |
| 100 | |
| 101 | def compress_int4_weight(weight: torch.Tensor): # (n, m) |
nothing calls this directly
no test coverage detected