MCPcopy Create free account
hub / github.com/OpenBMB/ToolBench / CLinear

Class CLinear

toolbench/model/compression.py:26–35  ·  view source on GitHub ↗

Compressed Linear Layer.

Source from the content-addressed store, hash-verified

24
25
26class CLinear(nn.Module):
27 """Compressed Linear Layer."""
28
29 def __init__(self, weight=None, bias=None, device=None):
30 super().__init__()
31 self.weight = weight
32 self.bias = bias
33
34 def forward(self, input):
35 return F.linear(input.to(self.weight.dtype), self.weight, self.bias)
36
37
38def compress_module(module, target_device):

Callers 2

compress_moduleFunction · 0.85
apply_compressed_weightFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected