From 092828fbe30e40b72fc25d8ab9c56ac7ecb5afe4 Mon Sep 17 00:00:00 2001 From: xzl Date: Mon, 5 Jun 2017 17:42:33 +0800 Subject: [PATCH] modify the doc of the interface --- paddle/parameter/ParameterUpdaterHook.cpp | 6 +++--- proto/ParameterConfig.proto | 4 ++-- python/paddle/trainer_config_helpers/attrs.py | 11 ++++------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/paddle/parameter/ParameterUpdaterHook.cpp b/paddle/parameter/ParameterUpdaterHook.cpp index e29494868..5e8c77ced 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 53e3b94f0..360342bac 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 a0ad8c445..556701ca7 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 """ -- GitLab