MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / forward

Method forward

diffsynth/models/kolors_text_encoder.py:80–89  ·  view source on GitHub ↗
(ctx, inp: torch.Tensor, quant_w: torch.Tensor, scale_w: torch.Tensor, weight_bit_width)

Source from the content-addressed store, hash-verified

78class W8A16Linear(torch.autograd.Function):
79 @staticmethod
80 def forward(ctx, inp: torch.Tensor, quant_w: torch.Tensor, scale_w: torch.Tensor, weight_bit_width):
81 ctx.inp_shape = inp.size()
82 ctx.weight_bit_width = weight_bit_width
83 out_features = quant_w.size(0)
84 inp = inp.contiguous().view(-1, inp.size(-1))
85 weight = extract_weight_to_half(quant_w, scale_w, weight_bit_width)
86 ctx.weight_shape = weight.size()
87 output = inp.mm(weight.t())
88 ctx.save_for_backward(inp, quant_w, scale_w)
89 return output.view(*(ctx.inp_shape[:-1] + (out_features,)))
90
91 @staticmethod
92 def backward(ctx, grad_output: torch.Tensor):

Callers

nothing calls this directly

Calls 1

extract_weight_to_halfFunction · 0.85

Tested by

no test coverage detected