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

Function test_bitlinear_weight_group_scaling

tests/tests.py:109–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107
108
109def test_bitlinear_weight_group_scaling():
110 layer = BitLinear(10, 20, groups=5)
111 weight = layer.weight.view(layer.groups, -1)
112 beta = torch.abs(weight).sum(dim=1, keepdim=True) / (
113 weight.shape[0] * weight.shape[1]
114 )
115 scaled_weight = weight * beta
116 assert torch.allclose(scaled_weight, layer.weight.view(20, 10))
117
118
119def test_bitlinear_input_quantization(random_tensor):

Callers

nothing calls this directly

Calls 1

BitLinearClass · 0.90

Tested by

no test coverage detected