Parameter Attribute


alias of ParameterAttribute


alias of ExtraLayerAttribute


alias of HookAttribute


alias of HookAttribute


alias of ParameterAttribute


alias of ExtraLayerAttribute

class paddle.v2.attr.ParameterAttribute(name=None, is_static=False, initial_std=None, initial_mean=None, initial_max=None, initial_min=None, l1_rate=None, l2_rate=None, learning_rate=None, momentum=None, gradient_clipping_threshold=None, sparse_update=False, update_hooks=None, initializer=None)

Parameter Attributes object. To fine-tuning network training process, user can set attribute to control training details, such as l1,l2 rate / learning rate / how to init param.


  • is_static (bool) – True if this parameter will be fixed while training.
  • initial_std (float or None) – Gauss Random initialization standard deviation. None if not using Gauss Random initialize parameter.
  • initial_mean (float or None) – Gauss Random initialization mean. None if not using Gauss Random initialize parameter.
  • initial_max (float or None) – Uniform initialization max value.
  • initial_min (float or None) – Uniform initialization min value.
  • l1_rate (float or None) – the l1 regularization factor
  • l2_rate (float or None) – the l2 regularization factor
  • learning_rate (float or None) – The parameter learning rate. None means 1. The learning rate when optimize is LEARNING_RATE = GLOBAL_LEARNING_RATE * PARAMETER_LEARNING_RATE * SCHEDULER_FACTOR.
  • momentum (float or None) – The parameter momentum. None means use global value.
  • gradient_clipping_threshold (float) – gradient clipping threshold. If gradient value larger than some value, will be clipped.
  • sparse_update (bool) – Enable sparse update for this parameter. It will enable both local and remote sparse update.
  • update_hooks (HookAttribute) – A HookAttribute object.
  • initializer (callable object) – If not None, it should be a callable object which accepts a parameter name and returns numpy array for the initial value of the parameter

Set default parameter name. If parameter not set, then will use default parameter name.

Parameters:name (basestring) – default parameter name.
class paddle.v2.attr.ExtraLayerAttribute(error_clipping_threshold=None, drop_rate=None, device=None)

Some high level layer attributes config. You can set all attributes here, but some layer doesn’t support all attributes. If you set an attribute to a layer that not support this attribute, paddle will print an error and core.

  • error_clipping_threshold (float) – Error clipping threshold.
  • drop_rate (float) – Dropout rate. Dropout will create a mask on layer output. The dropout rate is the zero rate of this mask. The details of what dropout is please refer to here.
  • device (int) –

    device ID of layer. device=-1, use CPU. device>=0, use GPU. The details allocation in parallel_nn please refer to here.