Tencent / PocketFlow

An Automatic Model Compression (AutoMC) framework for developing smaller and faster AI applications.
https://pocketflow.github.io
Other
2.78k stars 490 forks source link

some confusions about finding c_new channels #158

Open hunterkun opened 5 years ago

hunterkun commented 5 years ago

The following code snippet makes me puzzled. I know it is used to select c_new channels from c_in. WHY the lbound, rbound for channels and left, right for alpha are adjusted as you write. The original paper seems not talk about how to adjust those to find the c_new. https://github.com/Tencent/PocketFlow/blob/master/learners/channel_pruning/channel_pruner.py#L549-L565

jiaxiang-wu commented 5 years ago

This part is used to adjust alpha to reach the desired pruning ratio for the current layer.

hunterkun commented 5 years ago

yeah, i have knew that it is used to adjust alpha, but wonder the way you did comes from what kind of algorithm. i'm not clearly understand why left and right of alpha are adjusted like that.

jiaxiang-wu commented 5 years ago

The pruning ratio changes monotonically w.r.t. the value of alpha, so we do a bi-search to determine which alpha can give us the desired pruning ratio.

hunterkun commented 5 years ago

Thanks for your instant reply. I have one more question, what is the intention of getting around the case abs(left - right) <= right * 0.1 and the way you adjust lbound, rbound and left.

                elif abs(left - right) <= right * 0.1:
                    if lbound > 1:
                        lbound = lbound - 1
                    if rbound < c_in:
                        rbound = rbound + 1
                    left = left / 1.2
                    right = right * 1.2
jiaxiang-wu commented 5 years ago

@psyyz10 Can you take a look at this?