(weight, type, reconstruct_config)
| 23 | return final_enc, final_dec |
| 24 | |
| 25 | def get_replacement_module_grad(weight, type, reconstruct_config): |
| 26 | cfg = reconstruct_config[type] |
| 27 | if type == 'svd': |
| 28 | Ur, Sr, Vrt = get_svd_grad(weight.detach(), cfg['rank']) |
| 29 | final_enc = torch.tensor(Ur, dtype=weight.dtype, device=weight.device) |
| 30 | final_dec = torch.tensor(Vrt, dtype=weight.dtype, device=weight.device) |
| 31 | Sr = torch.tensor(Sr, dtype=weight.dtype, device=weight.device) |
| 32 | else: |
| 33 | raise NotImplementedError(f"{type} is currently not supported.") |
| 34 | return final_enc, final_dec, Sr |
| 35 | |
| 36 | |
| 37 |
no test coverage detected