MCPcopy Create free account
hub / github.com/kyegomez/BitNet / weight_quant

Function weight_quant

bitnet/bitlinear.py:20–24  ·  view source on GitHub ↗
(w: Tensor)

Source from the content-addressed store, hash-verified

18
19
20def weight_quant(w: Tensor):
21 scale = w.abs().mean()
22 e = w.mean()
23 u = (w - e).sign() * scale
24 return u
25
26
27class BitLinear(nn.Linear):

Callers 1

forwardMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected