提交 298977c4 编写于 作者: W wangmeng28

Fix doc of ParameterAttribute

上级 5593858d
...@@ -58,12 +58,12 @@ def is_compatible_with(x, Type): ...@@ -58,12 +58,12 @@ def is_compatible_with(x, Type):
class HookAttribute(object): class HookAttribute(object):
""" """
Hook Attribute object. As a member of ParameterAttribute class, the hook is an auxiliary operation that occurs Hook Attribute object. As a member of ParameterAttribute class, the hook is an auxiliary operation that occurs
during training process of a layer with parameters, such as img_conv layer, fc layer. during training process of a layer with parameters, such as img_conv layer, fc layer.
:param type: Hook type, currently supported types: :param type: Hook type, currently supported types:
'pruning' : user specify a sparsity_ratio before training started, and the 'pruning' : user specify a sparsity_ratio before training started, and the
network will prune the parameters based on the sparsity_ratio. network will prune the parameters based on the sparsity_ratio.
eg: The definition of Hook object can be hk = HookAttribute('pruning', 0.6) eg: The definition of Hook object can be hk = HookAttribute('pruning', 0.6)
The specific usage can be paddle.layer.img_conv(input=img, filter_size=3, The specific usage can be paddle.layer.img_conv(input=img, filter_size=3,
num_channels=3, num_filters=64, num_channels=3, num_filters=64,
...@@ -71,10 +71,10 @@ class HookAttribute(object): ...@@ -71,10 +71,10 @@ class HookAttribute(object):
The pruning details can be found https://arxiv.org/pdf/1506.02626.pdf The pruning details can be found https://arxiv.org/pdf/1506.02626.pdf
:type type: string :type type: string
:param sparsity_ratio: Must be specified if hook type is 'pruning', :param sparsity_ratio: Must be specified if hook type is 'pruning',
it represents the ratio of the zero elements to be set by the Parameter. it represents the ratio of the zero elements to be set by the Parameter.
:type sparsity_ratio: float or None :type sparsity_ratio: float or None
""" """
def __init__(self, type, sparsity_ratio=None): def __init__(self, type, sparsity_ratio=None):
...@@ -130,10 +130,12 @@ class ParameterAttribute(object): ...@@ -130,10 +130,12 @@ class ParameterAttribute(object):
:param sparse_update: Enable sparse update for this parameter. It will :param sparse_update: Enable sparse update for this parameter. It will
enable both local and remote sparse update. enable both local and remote sparse update.
:type sparse_update: bool :type sparse_update: bool
:param update_hooks: A HookAttribute object.
:type update_hooks: HookAttribute
:param initializer: If not None, it should be a callable object which accepts :param initializer: If not None, it should be a callable object which accepts
a parameter name and returns numpy array for the initial a parameter name and returns numpy array for the initial
value of the parameter value of the parameter
:param initializer: callable object :type initializer: callable object
""" """
def __init__(self, def __init__(self,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册