503a3579511fcb40642a09958dd5377875647309,src/sdk/pynni/nni/compression/torch/builtin_pruners.py,L1FilterPruner,calc_mask,#L1FilterPruner#Any#Any#,308
Before Change
if k == 0:
return torch.ones(weight.shape).type_as(weight)
w_abs_structured = w_abs.view(filters, -1).sum(dim=1)
threshold = torch.topk(w_abs_structured.view(-1), k, largest=False).values.max()
mask = torch.gt(w_abs_structured, threshold)[:, None, None, None].expand_as(weight).type_as(weight)
finally:
self.mask_dict.update({layer.name: mask})
After Change
if k == 0:
return torch.ones(weight.shape).type_as(weight)
w_abs_structured = w_abs.view(filters, -1).sum(dim=1)
threshold = torch.topk(w_abs_structured.view(-1), k, largest=False)[0].max()
mask = torch.gt(w_abs_structured, threshold)[:, None, None, None].expand_as(weight).type_as(weight)
finally:
self.mask_dict.update({layer.name: mask})
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 4
Instances
Project Name: microsoft/nni
Commit Name: 503a3579511fcb40642a09958dd5377875647309
Time: 2019-11-24
Author: lanny@mail.hfut.edu.cn
File Name: src/sdk/pynni/nni/compression/torch/builtin_pruners.py
Class Name: L1FilterPruner
Method Name: calc_mask
Project Name: microsoft/nni
Commit Name: 503a3579511fcb40642a09958dd5377875647309
Time: 2019-11-24
Author: lanny@mail.hfut.edu.cn
File Name: src/sdk/pynni/nni/compression/torch/builtin_pruners.py
Class Name: AGP_Pruner
Method Name: calc_mask
Project Name: microsoft/nni
Commit Name: 503a3579511fcb40642a09958dd5377875647309
Time: 2019-11-24
Author: lanny@mail.hfut.edu.cn
File Name: src/sdk/pynni/nni/compression/torch/builtin_pruners.py
Class Name: SlimPruner
Method Name: __init__
Project Name: microsoft/nni
Commit Name: 503a3579511fcb40642a09958dd5377875647309
Time: 2019-11-24
Author: lanny@mail.hfut.edu.cn
File Name: src/sdk/pynni/nni/compression/torch/builtin_pruners.py
Class Name: LevelPruner
Method Name: calc_mask