我是神经网络的初学者,我的项目现在是压缩对象检测模型以进行实时检测。最近,我找到了Altera提供的开源框架“ Neural Network Distiller”(该框架的github链接:https://github.com/NervanaSystems/distiller) 这是我打开文件“ magnitude_pruner.py”
时的代码from .pruner import _ParameterPruner
import distiller
class MagnitudeParameterPruner(_ParameterPruner):
def __init__(self, name, thresholds, **kwargs):
super(MagnitudeParameterPruner, self).__init__(name)
assert thresholds is not None
# Make sure there is a default threshold to use
assert '*' in thresholds
self.thresholds = thresholds
def set_param_mask(self, param, param_name, zeros_mask_dict, meta):
threshold = self.thresholds.get(param_name, self.thresholds['*'])
zeros_mask_dict[param_name].mask = distiller.threshold_mask(param.data, threshold)
谁能告诉我...的意思 在阈值中断言“ *”? 非常感谢