Skip to content

Error in structured pruning #6

Description

@CatoTea

Hi, when I prune resnet in structured type, I got error like this:

Traceback (most recent call last):
File "prune.py", line 131, in
pruner.prune(model, prune_rate)
File "/content/deep-compression-master/pruners/l1_pruner.py", line 70, in prune
self.structured_prune(model, prune_rate)
File "/content/deep-compression-master/pruners/l1_pruner.py", line 30, in structured_prune
threshold = np.percentile(channel_norms, prune_rate)
File "<array_function internals>", line 6, in percentile
File "/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py", line 3868, in percentile
a, q, axis, out, overwrite_input, interpolation, keepdims)
File "/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py", line 3988, in _quantile_unchecked
interpolation=interpolation)
File "/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py", line 3564, in _ureduce
r = func(a, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py", line 4103, in _quantile_ureduce_func
)), axis=0)
ValueError: operands could not be broadcast together with shapes (128,) (64,)

It seems because some element's lenth in channel_norms list are different. What should I do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions