(module,
               threshold,
               block_size,
               criteria,
               align=None,
               parameter='weight')
return None
Prunes blocks of module parameters based on magnitude (inplace).

    :param module: PyTorch module.
    :type module: `torch.nn.Module`
    :param threshold: Magnitude threshold for pruning.
    :type threshold: `float`
    :param block_size: Block size for pruning.
    :type block_size: `Tuple`
    :param criteria: Aggregation function for thresholding.
    :type criteria: `condensa.functional`
    :param align: Alignment of compressed parameters.
    :type align: `int`
    :param parameter: Module parameter to prune (default: 'weight')
    :type parameter: str
Prunes blocks of module parameters based on magnitude (inplace).
Prunes blocks of module parameters based on magnitude ( inplace ) .
def blockprune(module,
               threshold,
               block_size,
               criteria,
               align=None,
               parameter='weight'):
    """
    Prunes blocks of module parameters based on magnitude (inplace).

    :param module: PyTorch module.
    :type module: `torch.nn.Module`
    :param threshold: Magnitude threshold for pruning.
    :type threshold: `float`
    :param block_size: Block size for pruning.
    :type block_size: `Tuple`
    :param criteria: Aggregation function for thresholding.
    :type criteria: `condensa.functional`
    :param align: Alignment of compressed parameters.
    :type align: `int`
    :param parameter: Module parameter to prune (default: 'weight')
    :type parameter: str
    """
    __precheck(module)

    if not hasattr(module, parameter):
        raise ValueError('Could not find parameter \'{}\' in module',
                         parameter)

    p = getattr(module, parameter)
    ndim = p.dim()
    bdim = len(block_size)
    if ndim != bdim:
        raise RuntimeError(
            'Block must have same dimensions as parameter \'{}\''.format(
                parameter))

    if hasattr(module, 'condense'): module.condense.add(parameter)
    else: module.condense = set([parameter])

    if not cfg.__CONDENSA_RECORD_MODE__:
        mask = T.block_mask(p.data, threshold, block_size, criteria, align)
        T.apply_mask_inplace(p.data, mask)
        return mask
    return None
def blockprune ( module , threshold , block_size , criteria , align = None , parameter = 'weight' ) : __precheck ( module ) if not hasattr ( module , parameter ) : raise ValueError ( 'Could not find parameter \'{}\' in module' , parameter ) p = getattr ( module , parameter ) ndim = p . dim ( ) bdim = len ( block_size ) if ndim != bdim : raise RuntimeError ( 'Block must have same dimensions as parameter \'{}\'' . format ( parameter ) ) if hasattr ( module , 'condense' ) : module . condense . add ( parameter ) else : module . condense = set ( [ parameter ] ) if not cfg . __CONDENSA_RECORD_MODE__ : mask = T . block_mask ( p . data , threshold , block_size , criteria , align ) T . apply_mask_inplace ( p . data , mask ) return mask return None