diff --git a/paddle/parameter/ParameterUpdaterHook.cpp b/paddle/parameter/ParameterUpdaterHook.cpp index e29494868bc3b4ca39e95541771c727ec2ffef81..5e8c77ced03f5547f3d1145b1c7c4900a5223087 100644 --- a/paddle/parameter/ParameterUpdaterHook.cpp +++ b/paddle/parameter/ParameterUpdaterHook.cpp @@ -30,9 +30,9 @@ namespace paddle { /** * The static pruning hook - * Static means user specific a sparsity_ratio map before training started. The - * network will - * hold the sparsity_ratio maximum numbers of parameters, and cut off the rest. + * Static means user specific a sparsity_ratio before training start, and the + * network will prune the parameters based on the sparsity_ratio. More deatils + * can see https://arxiv.org/pdf/1506.02626.pdf. */ class StaticPruningHook : public IParameterUpdaterHook { diff --git a/proto/ParameterConfig.proto b/proto/ParameterConfig.proto index 53e3b94f031c3bd4967cd031cb362442754901f3..360342bac6facf47b91ff1424eecbf3b5b6ae71a 100644 --- a/proto/ParameterConfig.proto +++ b/proto/ParameterConfig.proto @@ -25,9 +25,9 @@ enum ParameterInitStrategy { } message ParameterUpdaterHookConfig { + // hook type such as 'pruning' required string type = 1; - //hook type such as 'pruning' - optional double sparsity_ratio = 3; + optional double sparsity_ratio = 2 [default = 0.8]; } message ParameterConfig { diff --git a/python/paddle/trainer_config_helpers/attrs.py b/python/paddle/trainer_config_helpers/attrs.py index a0ad8c4452521f394395c72ca9025694c484b525..556701ca7a88c595c4c16fe5b24ccd5b72ae887d 100644 --- a/python/paddle/trainer_config_helpers/attrs.py +++ b/python/paddle/trainer_config_helpers/attrs.py @@ -59,17 +59,14 @@ def is_compatible_with(x, Type): class HookAttribute(object): """ Hook Attribute object. The hook is an auxiliary operation that occurs - during network propagation. Such as pruning operation, It will cut off - redundant parameters in the network before training. More detail can see - here paddle/parameter/ParameterUpdaterHook.cpp + during network propagation. NOTE: IT IS A HIGH LEVEL USER INTERFACE. - + :param type: Hook type, eg: 'pruning' :type type: string - :param sparsity_ratio: Must be specified if hook type is 'pruning', - the network will hold the sparsity_ratio maximum parameters, and cut off the rest. - :type sparsity_ratio: float number between 0 and 1 + :param sparsity_ratio: Must be specified if hook type is 'pruning' + :type sparsity_ratio: float or None """