|
|
|
@ -88,6 +88,10 @@ class ParameterAttribute(object):
|
|
|
|
|
:type learning_rate: float or None
|
|
|
|
|
:param momentum: The parameter momentum. None means use global value.
|
|
|
|
|
:type momentum: float or None
|
|
|
|
|
:param gradient_clipping_threshold: gradient clipping threshold. If gradient
|
|
|
|
|
value larger than some value, will be
|
|
|
|
|
clipped.
|
|
|
|
|
:type gradient_clipping_threshold: float
|
|
|
|
|
:param sparse_update: Enable sparse update for this parameter. It will
|
|
|
|
|
enable both local and remote sparse update.
|
|
|
|
|
:type sparse_update: bool
|
|
|
|
@ -104,6 +108,7 @@ class ParameterAttribute(object):
|
|
|
|
|
l2_rate=None,
|
|
|
|
|
learning_rate=None,
|
|
|
|
|
momentum=None,
|
|
|
|
|
gradient_clipping_threshold=None,
|
|
|
|
|
sparse_update=False):
|
|
|
|
|
# initialize strategy.
|
|
|
|
|
if is_static:
|
|
|
|
@ -152,6 +157,11 @@ class ParameterAttribute(object):
|
|
|
|
|
self.attr['sparse_update'] = True
|
|
|
|
|
self.attr['sparse_remote_update'] = True
|
|
|
|
|
|
|
|
|
|
if gradient_clipping_threshold is not None and \
|
|
|
|
|
is_compatible_with(gradient_clipping_threshold, float):
|
|
|
|
|
self.attr['gradient_clipping_threshold'] = \
|
|
|
|
|
gradient_clipping_threshold
|
|
|
|
|
|
|
|
|
|
def set_default_parameter_name(self, name):
|
|
|
|
|
"""
|
|
|
|
|
Set default parameter name. If parameter not set, then will use default
|
|
|
|
|