4e21e721a65d0ac7c8465c6b7842dd39338bb3d0,src/sdk/pynni/nni/compression/torch/pruners.py,LevelPruner,calc_mask,#LevelPruner#Any#Any#,32
Before Change
threshold = torch.topk(w_abs.view(-1), k, largest=False)[0].max()
mask_weight = torch.gt(w_abs, threshold).type_as(weight)
mask = {"weight": mask_weight}
self.mask_dict.update({op_name: mask})
self.mask_calculated_ops.add(op_name)
else:
assert op_name in self.mask_dict, "op_name not in the mask_dict"
mask = self.mask_dict[op_name]
After Change
threshold = torch.topk(w_abs.view(-1), k, largest=False)[0].max()
mask_weight = torch.gt(w_abs, threshold).type_as(weight)
mask = {"weight": mask_weight}
if_calculated.copy_(torch.tensor(1)) // pylint: disable=not-callable
return mask
else:
return None
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: Microsoft/nni
Commit Name: 4e21e721a65d0ac7c8465c6b7842dd39338bb3d0
Time: 2020-02-09
Author: 656569648@qq.com
File Name: src/sdk/pynni/nni/compression/torch/pruners.py
Class Name: LevelPruner
Method Name: calc_mask
Project Name: Microsoft/nni
Commit Name: c7d58033db0e25736d33406ed262cb5232d366e8
Time: 2020-02-09
Author: 38930155+chicm-ms@users.noreply.github.com
File Name: src/sdk/pynni/nni/compression/torch/pruners.py
Class Name: AGP_Pruner
Method Name: calc_mask
Project Name: Microsoft/nni
Commit Name: d452a1665f802bfbe75372b6c942272b252c70a2
Time: 2020-02-05
Author: Quanlu.Zhang@microsoft.com
File Name: src/sdk/pynni/nni/compression/torch/pruners.py
Class Name: LotteryTicketPruner
Method Name: prune_iteration_start