(self, weight=None, bias=None, device=None)
| 40 | """Compressed Linear Layer.""" |
| 41 | |
| 42 | def __init__(self, weight=None, bias=None, device=None): |
| 43 | super().__init__() |
| 44 | if weight is None: |
| 45 | self.weight = None |
| 46 | elif isinstance(weight, Tensor): |
| 47 | self.weight = compress(weight.data.to(device), default_compression_config) |
| 48 | else: |
| 49 | self.weight = weight |
| 50 | self.bias = bias |
| 51 | |
| 52 | def forward(self, input: Tensor) -> Tensor: |
| 53 | weight = decompress(self.weight, default_compression_config) |