(module, target_device)
| 36 | |
| 37 | |
| 38 | def compress_module(module, target_device): |
| 39 | for name, child in module.named_children(): |
| 40 | if isinstance(child, nn.Linear): |
| 41 | setattr( |
| 42 | module, |
| 43 | name, |
| 44 | CLinear(child.weight, child.bias, target_device), |
| 45 | ) |
| 46 | compress_module(child, target_device) |
| 47 | |
| 48 | |
| 49 | def get_compressed_list(module, prefix=""): |