Compression Operators¶
-
condensa.pi.
blockprune
(module, threshold, block_size, criteria, align=None, parameter='weight')¶ Prunes blocks of module parameters based on magnitude (inplace).
- Parameters
module (torch.nn.Module) – PyTorch module.
threshold (float) – Magnitude threshold for pruning.
block_size (Tuple) – Block size for pruning.
criteria (condensa.functional) – Aggregation function for thresholding.
align (int) – Alignment of compressed parameters.
parameter (str) – Module parameter to prune (default: ‘weight’)
-
condensa.pi.
filter_prune
(module, threshold, criteria, align=None, prune_bias=True)¶ Prunes 3D blocks (filters) of module parameters based on magnitude (inplace).
- Parameters
module (torch.nn.Module) – PyTorch module.
threshold (float) – Magnitude threshold for pruning.
criteria (condensa.functional) – Aggregation function for thresholding.
align (int) – Alignment of compressed parameters.
prune_bias (bool) – Whether to prune corresponding biases.
-
condensa.pi.
neuron_prune
(module, threshold, criteria, align=None, prune_bias=True)¶ Prunes neurons based on magnitude (inplace).
- Parameters
module (torch.nn.Module) – PyTorch module.
threshold (float) – Magnitude threshold for pruning.
criteria (condensa.functional) – Aggregation function for thresholding.
align (int) – Alignment of compressed parameters.
prune_bias (bool) – Whether to prune corresponding biases.
-
condensa.pi.
prune
(module, threshold, parameter='weight')¶ Prunes module parameters based on magnitude (inplace).
- Parameters
module (torch.nn.Module) – PyTorch module.
threshold (float) – Magnitude threshold for pruning.
parameter (str) – Module parameter to prune (default: ‘weight’)
-
condensa.pi.
quantize
(module, dtype)¶ Quantizes module to given data type (inplace).
- Parameters
module (torch.nn.Module) – PyTorch module.
dtype – Target data type.
-
condensa.delta.
dequantize
(module, dtype)¶ De-quantizes module to given data type (inplace).
- Parameters
module (torch.nn.Module) – PyTorch module.
dtype – Target data type.