sparsegpt
Utility functions of SparseGPT.
Classes
SparseGPT-based sparse mask searching algorithm. |
Functions
Create a sparse mask for the given tensor. |
|
Invert a Hessian matrix. |
|
Prepare the inverse Hessian matrix. |
- class SparseGPTSearcher
Bases:
BaseSparseSearcher
SparseGPT-based sparse mask searching algorithm.
- after_search()
Remove Hessian artifcats from network.
- before_search()
Register the forward hook to collect the hessian matrix.
- property default_search_config: Dict[str, Any]
Get the default config for the searcher.
- create_sgpt_mask(tensor, hessian, config)
Create a sparse mask for the given tensor.
- Parameters:
tensor (Tensor) –
hessian (Tensor) –
config (Dict[str, Any]) –
- Return type:
Tensor
- invert(hessian)
Invert a Hessian matrix.
- Parameters:
hessian (Tensor) –
- Return type:
Tensor
- prepare(tensor, hessian, hessian_damp)
Prepare the inverse Hessian matrix.
- Parameters:
tensor (Tensor) –
hessian (Tensor) –
hessian_damp (float) –
- Return type:
Tuple[Tensor, Tensor]