Skip to content
Snippets Groups Projects
  • Neta Zmora's avatar
    05d5592e
    Low-level pruning API refactor (#401) · 05d5592e
    Neta Zmora authored
    Some refactoring of the low-level pruning API
    
    Added distiller/norms.py - for calculating norms of various sub-tensors.
    
    ranked_structures_pruner.py:
    -Removed l1_magnitude, l2_magnitude. Use instead distiller.norms.l1_norm
    -Lots of refactoring
    -replaced LpRankedStructureParameterPruner.ch_binary_map_to_mask with
    distiller.thresholding.expand_binary_map
    -FMReconstructionChannelPruner.rank_and_prune_channels used L2-norm
    by default and now uses L1-norm (i.e.magnitude_fn=l2_magnitude was
    replaced with magnitude_fn=distiller.norms.l1_norm)
    
    thresholding.py:
    -Delegated lots of the work to the new norms.py.
    -Removed support for 4D (entire convolution layers) since that has not been
    maintained for a longtime. This may break some old scripts that remove entire
    layers.
    -added expand_binary_map() explicitly so others can use it. Might need to
    move to a different file
    -removed threshold_policy()
    
    utils.py:
    -use distiller.norms.xxx for sparsity stats
    Low-level pruning API refactor (#401)
    Neta Zmora authored
    Some refactoring of the low-level pruning API
    
    Added distiller/norms.py - for calculating norms of various sub-tensors.
    
    ranked_structures_pruner.py:
    -Removed l1_magnitude, l2_magnitude. Use instead distiller.norms.l1_norm
    -Lots of refactoring
    -replaced LpRankedStructureParameterPruner.ch_binary_map_to_mask with
    distiller.thresholding.expand_binary_map
    -FMReconstructionChannelPruner.rank_and_prune_channels used L2-norm
    by default and now uses L1-norm (i.e.magnitude_fn=l2_magnitude was
    replaced with magnitude_fn=distiller.norms.l1_norm)
    
    thresholding.py:
    -Delegated lots of the work to the new norms.py.
    -Removed support for 4D (entire convolution layers) since that has not been
    maintained for a longtime. This may break some old scripts that remove entire
    layers.
    -added expand_binary_map() explicitly so others can use it. Might need to
    move to a different file
    -removed threshold_policy()
    
    utils.py:
    -use distiller.norms.xxx for sparsity stats