2de52a8976971da4836727ba9242fedcc7474878,src/sdk/pynni/nni/compression/torch/activation_rank_filter_pruners.py,ActivationRankFilterPruner,calc_mask,#ActivationRankFilterPruner#Any#Any#,66

Before Change


        

        weight = layer.module.weight.data
        op_name = layer.name
        op_type = layer.type
        assert 0 <= config.get("sparsity") < 1, "sparsity must in the range [0, 1)"
        assert op_type in ["Conv2d"], "only support Conv2d"
        assert op_type in config.get("op_types")
        if op_name in self.mask_calculated_ops:
            assert op_name in self.mask_dict
            return self.mask_dict.get(op_name)
        mask_weight = torch.ones(weight.size()).type_as(weight).detach()
        if hasattr(layer.module, "bias") and layer.module.bias is not None:
            mask_bias = torch.ones(layer.module.bias.size()).type_as(layer.module.bias).detach()
        else:

After Change


        assert 0 <= config.get("sparsity") < 1, "sparsity must in the range [0, 1)"
        assert op_type in ["Conv2d"], "only support Conv2d"
        assert op_type in config.get("op_types")
        if_calculated = kwargs["if_calculated"]
        if if_calculated:
            return None
        mask_weight = torch.ones(weight.size()).type_as(weight).detach()
        if hasattr(layer.module, "bias") and layer.module.bias is not None:
            mask_bias = torch.ones(layer.module.bias.size()).type_as(layer.module.bias).detach()
        else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 14

Instances


Project Name: microsoft/nni
Commit Name: 2de52a8976971da4836727ba9242fedcc7474878
Time: 2020-01-16
Author: 656569648@qq.com
File Name: src/sdk/pynni/nni/compression/torch/activation_rank_filter_pruners.py
Class Name: ActivationRankFilterPruner
Method Name: calc_mask


Project Name: microsoft/nni
Commit Name: 2de52a8976971da4836727ba9242fedcc7474878
Time: 2020-01-16
Author: 656569648@qq.com
File Name: src/sdk/pynni/nni/compression/torch/activation_rank_filter_pruners.py
Class Name: ActivationRankFilterPruner
Method Name: calc_mask


Project Name: microsoft/nni
Commit Name: 2de52a8976971da4836727ba9242fedcc7474878
Time: 2020-01-16
Author: 656569648@qq.com
File Name: src/sdk/pynni/nni/compression/torch/weight_rank_filter_pruners.py
Class Name: WeightRankFilterPruner
Method Name: calc_mask


Project Name: microsoft/nni
Commit Name: 2de52a8976971da4836727ba9242fedcc7474878
Time: 2020-01-16
Author: 656569648@qq.com
File Name: src/sdk/pynni/nni/compression/torch/pruners.py
Class Name: SlimPruner
Method Name: calc_mask