提交 0402a696 编写于 作者: R ranqiu

Update annotations of layers.py

上级 8e2cc754
...@@ -318,7 +318,7 @@ class LayerOutput(object): ...@@ -318,7 +318,7 @@ class LayerOutput(object):
:param activation: Layer Activation. :param activation: Layer Activation.
:type activation: BaseActivation. :type activation: BaseActivation.
:param parents: Layer's parents. :param parents: Layer's parents.
:type parents: list|tuple|collections.Sequence :type parents: list | tuple | collections.Sequence
""" """
def __init__(self, def __init__(self,
...@@ -435,7 +435,7 @@ def full_matrix_projection(input, size=0, param_attr=None): ...@@ -435,7 +435,7 @@ def full_matrix_projection(input, size=0, param_attr=None):
size=100, size=100,
param_attr=ParamAttr(name='_proj')) param_attr=ParamAttr(name='_proj'))
:param input: input layer :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param size: The parameter size. Means the width of parameter. :param size: The parameter size. Means the width of parameter.
:type size: int :type size: int
...@@ -471,7 +471,7 @@ def trans_full_matrix_projection(input, size=0, param_attr=None): ...@@ -471,7 +471,7 @@ def trans_full_matrix_projection(input, size=0, param_attr=None):
initial_mean=0.0, initial_mean=0.0,
initial_std=0.01)) initial_std=0.01))
:param input: input layer :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param size: The parameter size. Means the width of parameter. :param size: The parameter size. Means the width of parameter.
:type size: int :type size: int
...@@ -516,7 +516,7 @@ def table_projection(input, size=0, param_attr=None): ...@@ -516,7 +516,7 @@ def table_projection(input, size=0, param_attr=None):
param_attr=ParamAttr(name='_proj')) param_attr=ParamAttr(name='_proj'))
:param input: Input layer, which must contains id fields. :param input: The input of this layer, which must contains id fields.
:type input: LayerOutput :type input: LayerOutput
:param size: The parameter size. Means the width of parameter. :param size: The parameter size. Means the width of parameter.
:type size: int :type size: int
...@@ -561,7 +561,7 @@ def identity_projection(input, offset=None, size=None): ...@@ -561,7 +561,7 @@ def identity_projection(input, offset=None, size=None):
Note that both of two projections should not have any parameter. Note that both of two projections should not have any parameter.
:param input: Input Layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param offset: Offset, None if use default. :param offset: Offset, None if use default.
:type offset: int :type offset: int
...@@ -596,7 +596,7 @@ def slice_projection(input, slices): ...@@ -596,7 +596,7 @@ def slice_projection(input, slices):
Note that slice_projection should not have any parameter. Note that slice_projection should not have any parameter.
:param input: Input Layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param slices: An array of slice parameters. :param slices: An array of slice parameters.
Each slice contains the start and end offsets based Each slice contains the start and end offsets based
...@@ -634,7 +634,7 @@ def scaling_projection(input, param_attr=None): ...@@ -634,7 +634,7 @@ def scaling_projection(input, param_attr=None):
proj = scaling_projection(input=layer) proj = scaling_projection(input=layer)
:param input: Input Layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param param_attr: Parameter config, None if use default. :param param_attr: Parameter config, None if use default.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
...@@ -663,7 +663,7 @@ def dotmul_projection(input, param_attr=None): ...@@ -663,7 +663,7 @@ def dotmul_projection(input, param_attr=None):
proj = dotmul_projection(input=layer) proj = dotmul_projection(input=layer)
:param input: Input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param param_attr: Parameter config, None if use default. :param param_attr: Parameter config, None if use default.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
...@@ -734,7 +734,7 @@ def context_projection(input, ...@@ -734,7 +734,7 @@ def context_projection(input,
after context projection and not set padding_attr, sequence will after context projection and not set padding_attr, sequence will
be [ 0AB ABC BCD CDE DEF EFG FG0 ]. be [ 0AB ABC BCD CDE DEF EFG FG0 ].
:param input: Input Sequence. :param input: The input of this layer, which should be a sequence.
:type input: LayerOutput :type input: LayerOutput
:param context_len: context length. :param context_len: context length.
:type context_len: int :type context_len: int
...@@ -744,7 +744,7 @@ def context_projection(input, ...@@ -744,7 +744,7 @@ def context_projection(input,
:param padding_attr: Padding Parameter Attribute. If false, it means padding :param padding_attr: Padding Parameter Attribute. If false, it means padding
always be zero. Otherwise Padding is learnable, and always be zero. Otherwise Padding is learnable, and
parameter attribute is set by this parameter. parameter attribute is set by this parameter.
:type padding_attr: bool|ParameterAttribute :type padding_attr: bool | ParameterAttribute
:return: Projection :return: Projection
:rtype: Projection :rtype: Projection
""" """
...@@ -782,13 +782,13 @@ class MixedLayerType(LayerOutput): ...@@ -782,13 +782,13 @@ class MixedLayerType(LayerOutput):
:type name: basestring :type name: basestring
:param size: layer size. :param size: layer size.
:type size: int :type size: int
:param act: activation type. :param act: Activation type.
:type act: BaseActivation :type act: BaseActivation
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute or None :type layer_attr: ExtraLayerAttribute or None
""" """
...@@ -880,15 +880,15 @@ def mixed_layer(size=0, ...@@ -880,15 +880,15 @@ def mixed_layer(size=0,
:type name: basestring :type name: basestring
:param size: layer size. :param size: layer size.
:type size: int :type size: int
:param input: inputs layer. It is an optional parameter. If set, :param input: The input of this layer. It is an optional parameter. If set,
then this function will just return layer's name. then this function will just return layer's name.
:param act: Activation Type. :param act: Activation Type. LinearActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: The extra layer config. Default is None. :param layer_attr: The extra layer config. Default is None.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:return: MixedLayerType object can add inputs or layer name. :return: MixedLayerType object can add inputs or layer name.
...@@ -929,9 +929,9 @@ def data_layer(name, size, depth=None, height=None, width=None, ...@@ -929,9 +929,9 @@ def data_layer(name, size, depth=None, height=None, width=None,
:param size: Size of this data layer. :param size: Size of this data layer.
:type size: int :type size: int
:param height: Height of this data layer, used for image :param height: Height of this data layer, used for image
:type height: int|None :type height: int | None
:param width: Width of this data layer, used for image :param width: Width of this data layer, used for image
:type width: int|None :type width: int | None
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute. :type layer_attr: ExtraLayerAttribute.
:return: LayerOutput object. :return: LayerOutput object.
...@@ -966,15 +966,15 @@ def embedding_layer(input, size, name=None, param_attr=None, layer_attr=None): ...@@ -966,15 +966,15 @@ def embedding_layer(input, size, name=None, param_attr=None, layer_attr=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer for this embedding. NOTE: must be Index Data. :param input: The input of this layer, which must be Index Data.
:type input: LayerOutput :type input: LayerOutput
:param size: The embedding dimension. :param size: The embedding dimension.
:type size: int :type size: int
:param param_attr: The embedding parameter attribute. See ParameterAttribute :param param_attr: The embedding parameter attribute. See ParameterAttribute
for details. for details.
:type param_attr: ParameterAttribute|None :type param_attr: ParameterAttribute | None
:param layer_attr: Extra layer Config. Default is None. :param layer_attr: Extra layer Config. Default is None.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -1021,11 +1021,11 @@ def fc_layer(input, ...@@ -1021,11 +1021,11 @@ def fc_layer(input,
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. Could be a list/tuple of input layer. :param input: The input of this layer.
:type input: LayerOutput|list|tuple :type input: LayerOutput | list | tuple
:param size: The layer dimension. :param size: The layer dimension.
:type size: int :type size: int
:param act: Activation Type. Default is tanh. :param act: Activation Type. TanhActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param param_attr: The Parameter Attribute|list. :param param_attr: The Parameter Attribute|list.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
...@@ -1033,9 +1033,9 @@ def fc_layer(input, ...@@ -1033,9 +1033,9 @@ def fc_layer(input,
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -1072,8 +1072,8 @@ def printer_layer(input, format=None, name=None): ...@@ -1072,8 +1072,8 @@ def printer_layer(input, format=None, name=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. Could be a list/tuple of input layer. :param input: The input of this layer.
:type input: LayerOutput|list|tuple :type input: LayerOutput | list | tuple
:return: LayerOutput :return: LayerOutput
""" """
if isinstance(input, LayerOutput): if isinstance(input, LayerOutput):
...@@ -1110,7 +1110,7 @@ def priorbox_layer(input, ...@@ -1110,7 +1110,7 @@ def priorbox_layer(input,
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param image: The network input image. :param image: The network input image.
:type image: LayerOutput :type image: LayerOutput
...@@ -1306,7 +1306,7 @@ def cross_channel_norm_layer(input, name=None, param_attr=None): ...@@ -1306,7 +1306,7 @@ def cross_channel_norm_layer(input, name=None, param_attr=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param param_attr: The Parameter Attribute|list. :param param_attr: The Parameter Attribute|list.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
...@@ -1371,20 +1371,20 @@ def pooling_layer(input, ...@@ -1371,20 +1371,20 @@ def pooling_layer(input,
:type agg_level: AggregateLevel :type agg_level: AggregateLevel
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: input layer name. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param pooling_type: Type of pooling, MaxPooling(default), AvgPooling, :param pooling_type: Type of pooling, MaxPooling(default), AvgPooling,
SumPooling, SquareRootNPooling. SumPooling, SquareRootNPooling.
:type pooling_type: BasePoolingType|None :type pooling_type: BasePoolingType | None
:param stride: The step size between successive pooling regions. :param stride: The step size between successive pooling regions.
:type stride: Int :type stride: Int
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: The Extra Attributes for layer, such as dropout. :param layer_attr: The Extra Attributes for layer, such as dropout.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -1469,11 +1469,11 @@ def lstmemory(input, ...@@ -1469,11 +1469,11 @@ def lstmemory(input,
:type name: basestring :type name: basestring
:param size: DEPRECATED. size of the lstm cell :param size: DEPRECATED. size of the lstm cell
:type size: int :type size: int
:param input: input layer name. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param reverse: is sequence process reversed or not. :param reverse: is sequence process reversed or not.
:type reverse: bool :type reverse: bool
:param act: activation type, TanhActivation by default. :math:`h_t` :param act: Activation type. TanhActivation is the default. :math:`h_t`
:type act: BaseActivation :type act: BaseActivation
:param gate_act: gate activation type, SigmoidActivation by default. :param gate_act: gate activation type, SigmoidActivation by default.
:type gate_act: BaseActivation :type gate_act: BaseActivation
...@@ -1483,11 +1483,11 @@ def lstmemory(input, ...@@ -1483,11 +1483,11 @@ def lstmemory(input,
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: Parameter Attribute. :param param_attr: Parameter Attribute.
:type param_attr: ParameterAttribute|None|False :type param_attr: ParameterAttribute | None | False
:param layer_attr: Extra Layer attribute :param layer_attr: Extra Layer attribute
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -1591,14 +1591,14 @@ def grumemory(input, ...@@ -1591,14 +1591,14 @@ def grumemory(input,
gru = grumemory(input) gru = grumemory(input)
:param name: The gru layer name. :param name: The gru layer name.
:type name: None|basestring :type name: None | basestring
:param input: input layer. :param input: The input of this layer.
:type input: LayerOutput. :type input: LayerOutput.
:param size: DEPRECATED. size of the gru cell :param size: DEPRECATED. size of the gru cell
:type size: int :type size: int
:param reverse: Whether sequence process is reversed or not. :param reverse: Whether sequence process is reversed or not.
:type reverse: bool :type reverse: bool
:param act: activation type, TanhActivation by default. This activation :param act: Activation type, TanhActivation is the default. This activation
affects the :math:`{\\tilde{h_t}}`. affects the :math:`{\\tilde{h_t}}`.
:type act: BaseActivation :type act: BaseActivation
:param gate_act: gate activation type, SigmoidActivation by default. :param gate_act: gate activation type, SigmoidActivation by default.
...@@ -1609,11 +1609,11 @@ def grumemory(input, ...@@ -1609,11 +1609,11 @@ def grumemory(input,
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: Parameter Attribute. :param param_attr: Parameter Attribute.
:type param_attr: ParameterAttribute|None|False :type param_attr: ParameterAttribute | None | False
:param layer_attr: Extra Layer attribute :param layer_attr: Extra Layer attribute
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -1670,7 +1670,7 @@ def last_seq(input, ...@@ -1670,7 +1670,7 @@ def last_seq(input,
:param agg_level: Aggregated level :param agg_level: Aggregated level
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: Input layer name. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param stride: The step size between successive pooling regions. :param stride: The step size between successive pooling regions.
:type stride: Int :type stride: Int
...@@ -1726,7 +1726,7 @@ def first_seq(input, ...@@ -1726,7 +1726,7 @@ def first_seq(input,
:param agg_level: aggregation level :param agg_level: aggregation level
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: Input layer name. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param stride: The step size between successive pooling regions. :param stride: The step size between successive pooling regions.
:type stride: Int :type stride: Int
...@@ -1799,7 +1799,7 @@ def expand_layer(input, ...@@ -1799,7 +1799,7 @@ def expand_layer(input,
expand_as=layer2, expand_as=layer2,
expand_level=ExpandLevel.FROM_NO_SEQUENCE) expand_level=ExpandLevel.FROM_NO_SEQUENCE)
:param input: Input layer :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param expand_as: Expand as this layer's sequence info. :param expand_as: Expand as this layer's sequence info.
:type expand_as: LayerOutput :type expand_as: LayerOutput
...@@ -1809,7 +1809,7 @@ def expand_layer(input, ...@@ -1809,7 +1809,7 @@ def expand_layer(input,
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param expand_level: whether input layer is timestep(default) or sequence. :param expand_level: whether input layer is timestep(default) or sequence.
:type expand_level: ExpandLevel :type expand_level: ExpandLevel
:param layer_attr: extra layer attributes. :param layer_attr: extra layer attributes.
...@@ -1858,7 +1858,7 @@ def repeat_layer(input, ...@@ -1858,7 +1858,7 @@ def repeat_layer(input,
expand = repeat_layer(input=layer, num_repeats=4) expand = repeat_layer(input=layer, num_repeats=4)
:param input: Input layer :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param num_repeats: Repeat the input so many times :param num_repeats: Repeat the input so many times
:type num_repeats: int :type num_repeats: int
...@@ -1869,7 +1869,7 @@ def repeat_layer(input, ...@@ -1869,7 +1869,7 @@ def repeat_layer(input,
False for treating input as column vector and repeating False for treating input as column vector and repeating
in the row direction. in the row direction.
:type as_row_vector: bool :type as_row_vector: bool
:param act: Activation type. :param act: Activation type. IdentityActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:type name: basestring :type name: basestring
:param layer_attr: extra layer attributes. :param layer_attr: extra layer attributes.
...@@ -1917,13 +1917,13 @@ def seq_reshape_layer(input, ...@@ -1917,13 +1917,13 @@ def seq_reshape_layer(input,
reshape = seq_reshape_layer(input=layer, reshape_size=4) reshape = seq_reshape_layer(input=layer, reshape_size=4)
:param input: Input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param reshape_size: the size of reshaped sequence. :param reshape_size: the size of reshaped sequence.
:type reshape_size: int :type reshape_size: int
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param act: Activation type. :param act: Activation type. IdentityActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param layer_attr: extra layer attributes. :param layer_attr: extra layer attributes.
:type layer_attr: ExtraLayerAttribute. :type layer_attr: ExtraLayerAttribute.
...@@ -1931,7 +1931,7 @@ def seq_reshape_layer(input, ...@@ -1931,7 +1931,7 @@ def seq_reshape_layer(input,
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -1970,8 +1970,8 @@ def interpolation_layer(input, weight, name=None, layer_attr=None): ...@@ -1970,8 +1970,8 @@ def interpolation_layer(input, weight, name=None, layer_attr=None):
interpolation = interpolation_layer(input=[layer1, layer2], weight=layer3) interpolation = interpolation_layer(input=[layer1, layer2], weight=layer3)
:param input: Input layer. :param input: The input of this layer.
:type input: list|tuple :type input: list | tuple
:param weight: Weight layer. :param weight: Weight layer.
:type weight: LayerOutput :type weight: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
...@@ -2023,11 +2023,11 @@ def bilinear_interp_layer(input, ...@@ -2023,11 +2023,11 @@ def bilinear_interp_layer(input,
:param input: A input layer. :param input: A input layer.
:type input: LayerOutput. :type input: LayerOutput.
:param out_size_x: bilinear interpolation output width. :param out_size_x: bilinear interpolation output width.
:type out_size_x: int|None :type out_size_x: int | None
:param out_size_y: bilinear interpolation output height. :param out_size_y: bilinear interpolation output height.
:type out_size_y: int|None :type out_size_y: int | None
:param name: The layer's name, which cna not be specified. :param name: The layer's name, which cna not be specified.
:type name: None|basestring :type name: None | basestring
:param layer_attr: Extra Layer attribute. :param layer_attr: Extra Layer attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:return: LayerOutput object. :return: LayerOutput object.
...@@ -2075,7 +2075,7 @@ def power_layer(input, weight, name=None, layer_attr=None): ...@@ -2075,7 +2075,7 @@ def power_layer(input, weight, name=None, layer_attr=None):
power = power_layer(input=layer1, weight=layer2) power = power_layer(input=layer1, weight=layer2)
:param input: Input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param weight: Weight layer. :param weight: Weight layer.
:type weight: LayerOutput :type weight: LayerOutput
...@@ -2119,7 +2119,7 @@ def scaling_layer(input, weight, name=None, layer_attr=None): ...@@ -2119,7 +2119,7 @@ def scaling_layer(input, weight, name=None, layer_attr=None):
scale = scaling_layer(input=layer1, weight=layer2) scale = scaling_layer(input=layer1, weight=layer2)
:param input: Input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param weight: Weight layer. :param weight: Weight layer.
:type weight: LayerOutput :type weight: LayerOutput
...@@ -2159,7 +2159,7 @@ def trans_layer(input, name=None, layer_attr=None): ...@@ -2159,7 +2159,7 @@ def trans_layer(input, name=None, layer_attr=None):
trans = trans_layer(input=layer) trans = trans_layer(input=layer)
:param input: Input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
...@@ -2197,7 +2197,7 @@ def rotate_layer(input, height, width, name=None, layer_attr=None): ...@@ -2197,7 +2197,7 @@ def rotate_layer(input, height, width, name=None, layer_attr=None):
height=100, height=100,
width=100) width=100)
:param input: Input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param height: The height of the sample matrix :param height: The height of the sample matrix
:type height: int :type height: int
...@@ -2306,22 +2306,21 @@ def hsigmoid(input, ...@@ -2306,22 +2306,21 @@ def hsigmoid(input,
cost = hsigmoid(input=[layer1, layer2], cost = hsigmoid(input=[layer1, layer2],
label=data_layer) label=data_layer)
:param input: Input layers. It could be a LayerOutput or list/tuple of :param input: The input of this layer.
LayerOutput. :type input: LayerOutput | list | tuple
:type input: LayerOutput|list|tuple
:param label: Label layer. :param label: Label layer.
:type label: LayerOutput :type label: LayerOutput
:param num_classes: number of classes. :param num_classes: number of classes.
:type num_classes: int|None :type num_classes: int | None
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: Parameter Attribute. None means default parameter. :param param_attr: Parameter Attribute. None means default parameter.
:type param_attr: ParameterAttribute|None :type param_attr: ParameterAttribute | None
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:return: LayerOutput object. :return: LayerOutput object.
...@@ -2429,40 +2428,40 @@ def img_conv_layer(input, ...@@ -2429,40 +2428,40 @@ def img_conv_layer(input,
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: Layer Input. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param filter_size: The x dimension of a filter kernel. Or input a tuple for :param filter_size: The x dimension of a filter kernel. Or input a tuple for
two image dimension. two image dimension.
:type filter_size: int|tuple|list :type filter_size: int | tuple | list
:param filter_size_y: The y dimension of a filter kernel. Since PaddlePaddle :param filter_size_y: The y dimension of a filter kernel. Since PaddlePaddle
currently supports rectangular filters, the filter's currently supports rectangular filters, the filter's
shape will be (filter_size, filter_size_y). shape will be (filter_size, filter_size_y).
:type filter_size_y: int|None :type filter_size_y: int | None
:param num_filters: Each filter group's number of filter :param num_filters: Each filter group's number of filter
:param act: Activation type. Default is tanh :param act: Activation type. ReluActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param groups: Group size of filters. :param groups: Group size of filters.
:type groups: int :type groups: int
:param stride: The x dimension of the stride. Or input a tuple for two image :param stride: The x dimension of the stride. Or input a tuple for two image
dimension. dimension.
:type stride: int|tuple|list :type stride: int | tuple | list
:param stride_y: The y dimension of the stride. :param stride_y: The y dimension of the stride.
:type stride_y: int :type stride_y: int
:param padding: The x dimension of the padding. Or input a tuple for two :param padding: The x dimension of the padding. Or input a tuple for two
image dimension image dimension
:type padding: int|tuple|list :type padding: int | tuple | list
:param padding_y: The y dimension of the padding. :param padding_y: The y dimension of the padding.
:type padding_y: int :type padding_y: int
:param dilation: The x dimension of the dilation. Or input a tuple for two :param dilation: The x dimension of the dilation. Or input a tuple for two
image dimension image dimension
:type dilation: int|tuple|list :type dilation: int | tuple | list
:param dilation_y: The y dimension of the dilation. :param dilation_y: The y dimension of the dilation.
:type dilation_y: int :type dilation_y: int
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param num_channels: number of input channels. If None will be set :param num_channels: number of input channels. If None will be set
automatically from previous output. automatically from previous output.
:type num_channels: int :type num_channels: int
...@@ -2616,15 +2615,15 @@ def img_pool_layer(input, ...@@ -2616,15 +2615,15 @@ def img_pool_layer(input,
:param padding: pooling padding width. :param padding: pooling padding width.
:type padding: int :type padding: int
:param padding_y: pooling padding height. It's equal to padding by default. :param padding_y: pooling padding height. It's equal to padding by default.
:type padding_y: int|None :type padding_y: int | None
:param name: name of pooling layer :param name: name of pooling layer
:type name: basestring. :type name: basestring.
:param input: layer's input :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param pool_size: pooling window width :param pool_size: pooling window width
:type pool_size: int :type pool_size: int
:param pool_size_y: pooling window height. It's eaqual to pool_size by default. :param pool_size_y: pooling window height. It's eaqual to pool_size by default.
:type pool_size_y: int|None :type pool_size_y: int | None
:param num_channels: number of input channel. :param num_channels: number of input channel.
:type num_channels: int :type num_channels: int
:param pool_type: pooling type. MaxPooling or AvgPooling. Default is :param pool_type: pooling type. MaxPooling or AvgPooling. Default is
...@@ -2633,7 +2632,7 @@ def img_pool_layer(input, ...@@ -2633,7 +2632,7 @@ def img_pool_layer(input,
:param stride: stride width of pooling. :param stride: stride width of pooling.
:type stride: int :type stride: int
:param stride_y: stride height of pooling. It is equal to stride by default. :param stride_y: stride height of pooling. It is equal to stride by default.
:type stride_y: int|None :type stride_y: int | None
:param layer_attr: Extra Layer attribute. :param layer_attr: Extra Layer attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:param ceil_mode: Wether to use ceil mode to calculate output height and with. :param ceil_mode: Wether to use ceil mode to calculate output height and with.
...@@ -2743,20 +2742,20 @@ def img_pool3d_layer(input, ...@@ -2743,20 +2742,20 @@ def img_pool3d_layer(input,
pool_type=MaxPooling()) pool_type=MaxPooling())
:param padding: pooling padding width. :param padding: pooling padding width.
:type padding: int|tuple|list :type padding: int | tuple | list
:param name: name of pooling layer :param name: name of pooling layer
:type name: basestring. :type name: basestring.
:param input: layer's input :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param pool_size: pooling window width :param pool_size: pooling window width
:type pool_size: int|tuple|list :type pool_size: int | tuple | list
:param num_channels: number of input channel. :param num_channels: number of input channel.
:type num_channels: int :type num_channels: int
:param pool_type: pooling type. MaxPooling or AvgPooling. Default is :param pool_type: pooling type. MaxPooling or AvgPooling. Default is
MaxPooling. MaxPooling.
:type pool_type: BasePoolingType :type pool_type: BasePoolingType
:param stride: stride width of pooling. :param stride: stride width of pooling.
:type stride: int|tuple|list :type stride: int | tuple | list
:param layer_attr: Extra Layer attribute. :param layer_attr: Extra Layer attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:param ceil_mode: Wether to use ceil mode to calculate output height and with. :param ceil_mode: Wether to use ceil mode to calculate output height and with.
...@@ -2855,7 +2854,7 @@ def spp_layer(input, ...@@ -2855,7 +2854,7 @@ def spp_layer(input,
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: layer's input. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param num_channels: number of input channel. :param num_channels: number of input channel.
:type num_channels: int :type num_channels: int
...@@ -2948,8 +2947,8 @@ def img_cmrnorm_layer(input, ...@@ -2948,8 +2947,8 @@ def img_cmrnorm_layer(input,
norm = img_cmrnorm_layer(input=net, size=5) norm = img_cmrnorm_layer(input=net, size=5)
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring :type name: None | basestring
:param input: layer's input. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param size: Normalize in number of :math:`size` feature maps. :param size: Normalize in number of :math:`size` feature maps.
:type size: int :type size: int
...@@ -3024,7 +3023,7 @@ def batch_norm_layer(input, ...@@ -3024,7 +3023,7 @@ def batch_norm_layer(input,
batch_norm for CPU. Otherwise, select batch norm batch_norm for CPU. Otherwise, select batch norm
type based on the specified type. If you use cudnn_batch_norm, type based on the specified type. If you use cudnn_batch_norm,
we suggested you use latest version, such as v5.1. we suggested you use latest version, such as v5.1.
:type batch_norm_type: None|string, None or "batch_norm" or "cudnn_batch_norm" :type batch_norm_type: None | string, None or "batch_norm" or "cudnn_batch_norm"
:param act: Activation Type. Better be relu. Because batch :param act: Activation Type. Better be relu. Because batch
normalization will normalize input near zero. normalization will normalize input near zero.
:type act: BaseActivation :type act: BaseActivation
...@@ -3034,7 +3033,7 @@ def batch_norm_layer(input, ...@@ -3034,7 +3033,7 @@ def batch_norm_layer(input,
:type num_channels: int :type num_channels: int
:param bias_attr: :math:`\\beta`, better be zero when initialize. So the :param bias_attr: :math:`\\beta`, better be zero when initialize. So the
initial_std=0, initial_mean=1 is best practice. initial_std=0, initial_mean=1 is best practice.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: :math:`\\gamma`, better be one when initialize. So the :param param_attr: :math:`\\gamma`, better be one when initialize. So the
initial_std=0, initial_mean=1 is best practice. initial_std=0, initial_mean=1 is best practice.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
...@@ -3046,7 +3045,7 @@ def batch_norm_layer(input, ...@@ -3046,7 +3045,7 @@ def batch_norm_layer(input,
testing. If False, it will use the mean testing. If False, it will use the mean
and variance of current batch of test data for and variance of current batch of test data for
testing. testing.
:type use_global_stats: bool|None. :type use_global_stats: bool | None.
:param moving_average_fraction: Factor used in the moving average :param moving_average_fraction: Factor used in the moving average
computation, referred to as facotr, computation, referred to as facotr,
:math:`runningMean = newMean*(1-factor) :math:`runningMean = newMean*(1-factor)
...@@ -3107,7 +3106,7 @@ def sum_to_one_norm_layer(input, name=None, layer_attr=None): ...@@ -3107,7 +3106,7 @@ def sum_to_one_norm_layer(input, name=None, layer_attr=None):
sum_to_one_norm = sum_to_one_norm_layer(input=layer) sum_to_one_norm = sum_to_one_norm_layer(input=layer)
:param input: Input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
...@@ -3143,7 +3142,7 @@ def row_l2_norm_layer(input, name=None, layer_attr=None): ...@@ -3143,7 +3142,7 @@ def row_l2_norm_layer(input, name=None, layer_attr=None):
row_l2_norm_layer = row_l2_norm_layer(input=layer) row_l2_norm_layer = row_l2_norm_layer(input=layer)
:param input: Input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
...@@ -3201,14 +3200,14 @@ def addto_layer(input, act=None, name=None, bias_attr=None, layer_attr=None): ...@@ -3201,14 +3200,14 @@ def addto_layer(input, act=None, name=None, bias_attr=None, layer_attr=None):
:type name: basestring :type name: basestring
:param input: Input layers. It could be a LayerOutput or list/tuple of :param input: Input layers. It could be a LayerOutput or list/tuple of
LayerOutput. LayerOutput.
:type input: LayerOutput|list|tuple :type input: LayerOutput | list | tuple
:param act: Activation Type, default is tanh. :param act: Activation Type. LinearActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: Extra Layer attribute. :param layer_attr: Extra Layer attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:return: LayerOutput object. :return: LayerOutput object.
...@@ -3260,8 +3259,8 @@ def concat_layer(input, act=None, name=None, layer_attr=None, bias_attr=None): ...@@ -3260,8 +3259,8 @@ def concat_layer(input, act=None, name=None, layer_attr=None, bias_attr=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: input layers or projections :param input: input layers or projections
:type input: list|tuple|collections.Sequence :type input: list | tuple | collections.Sequence
:param act: Activation type. :param act: Activation type. IdentityActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
...@@ -3356,7 +3355,7 @@ def seq_concat_layer(a, b, act=None, name=None, layer_attr=None, ...@@ -3356,7 +3355,7 @@ def seq_concat_layer(a, b, act=None, name=None, layer_attr=None,
:type a: LayerOutput :type a: LayerOutput
:param b: input sequence layer :param b: input sequence layer
:type b: LayerOutput :type b: LayerOutput
:param act: Activation type. :param act: Activation type. IdentityActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
...@@ -3364,7 +3363,7 @@ def seq_concat_layer(a, b, act=None, name=None, layer_attr=None, ...@@ -3364,7 +3363,7 @@ def seq_concat_layer(a, b, act=None, name=None, layer_attr=None,
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -3440,9 +3439,9 @@ def memory(name, ...@@ -3440,9 +3439,9 @@ def memory(name,
:param is_seq: DEPRECATED. is sequence for boot_layer :param is_seq: DEPRECATED. is sequence for boot_layer
:type is_seq: bool :type is_seq: bool
:param boot_layer: boot layer of memory. :param boot_layer: boot layer of memory.
:type boot_layer: LayerOutput|None :type boot_layer: LayerOutput | None
:param boot_bias: boot layer's bias :param boot_bias: boot layer's bias
:type boot_bias: ParameterAttribute|None :type boot_bias: ParameterAttribute | None
:param boot_bias_active_type: boot layer's active type. :param boot_bias_active_type: boot layer's active type.
:type boot_bias_active_type: BaseActivation :type boot_bias_active_type: BaseActivation
:param boot_with_const_id: boot layer's id. :param boot_with_const_id: boot layer's id.
...@@ -3537,19 +3536,17 @@ def lstm_step_layer(input, ...@@ -3537,19 +3536,17 @@ def lstm_step_layer(input,
:type input: LayerOutput :type input: LayerOutput
:param state: State Layer. :math:`c_{t-1}` :param state: State Layer. :math:`c_{t-1}`
:type state: LayerOutput :type state: LayerOutput
:param act: Activation type. Default is tanh :param act: Activation type. TanhActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param gate_act: Gate Activation Type. Default is sigmoid, and should :param gate_act: Gate Activation Type. SigmoidActivation is the default.
be sigmoid only.
:type gate_act: BaseActivation :type gate_act: BaseActivation
:param state_act: State Activation Type. Default is sigmoid, and should :param state_act: State Activation Type. TanhActivation is the default.
be sigmoid only.
:type state_act: BaseActivation :type state_act: BaseActivation
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: layer's extra attribute. :param layer_attr: layer's extra attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:return: LayerOutput object. :return: LayerOutput object.
...@@ -3600,13 +3597,15 @@ def gru_step_layer(input, ...@@ -3600,13 +3597,15 @@ def gru_step_layer(input,
:param output_mem: :param output_mem:
:param size: :param size:
:param act: :param act:
:type act: BaseActivation
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:param gate_act: :param gate_act: Activation type of this layer's two gates. Default is Sigmoid.
:type gate_act: BaseActivation
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: the parameter_attribute for transforming the output_mem :param param_attr: the parameter_attribute for transforming the output_mem
from previous step. from previous step.
:param layer_attr: :param layer_attr:
...@@ -3662,12 +3661,14 @@ def gru_step_naive_layer(input, ...@@ -3662,12 +3661,14 @@ def gru_step_naive_layer(input,
:param size: :param size:
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:param act: :param act:
:param gate_act: :type act: BaseActivation
:param gate_act: Activation type of this layer's two gates. Default is Sigmoid.
:type gate_act: BaseActivation
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: :param param_attr:
:param layer_attr: :param layer_attr:
:return: :return:
...@@ -3786,15 +3787,15 @@ def recurrent_layer(input, ...@@ -3786,15 +3787,15 @@ def recurrent_layer(input,
out_{i} = act(in_{i} + out_{i+1} * W) \\ \\ \\text{for} \\ start <= i < end out_{i} = act(in_{i} + out_{i+1} * W) \\ \\ \\text{for} \\ start <= i < end
:param input: Input Layer :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param act: activation. :param act: Activation type. TanhActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param param_attr: parameter attribute. :param param_attr: parameter attribute.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
...@@ -3901,7 +3902,7 @@ def recurrent_group(step, input, reverse=False, name=None, targetInlink=None): ...@@ -3901,7 +3902,7 @@ def recurrent_group(step, input, reverse=False, name=None, targetInlink=None):
StaticInput will be imported to each time step, and doesn't change StaticInput will be imported to each time step, and doesn't change
through time. It's a mechanism to access layer outside step function. through time. It's a mechanism to access layer outside step function.
:type input: LayerOutput|StaticInput|SubsequenceInput|list|tuple :type input: LayerOutput | StaticInput | SubsequenceInput | list | tuple
:param reverse: If reverse is set true, the recurrent unit will process the :param reverse: If reverse is set true, the recurrent unit will process the
input sequence in a reverse order. input sequence in a reverse order.
...@@ -3916,7 +3917,7 @@ def recurrent_group(step, input, reverse=False, name=None, targetInlink=None): ...@@ -3916,7 +3917,7 @@ def recurrent_group(step, input, reverse=False, name=None, targetInlink=None):
of words in each sentence) with all layer group's outputs. of words in each sentence) with all layer group's outputs.
targetInlink should be one of the layer group's input. targetInlink should be one of the layer group's input.
:type targetInlink: LayerOutput|SubsequenceInput :type targetInlink: LayerOutput | SubsequenceInput
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
...@@ -4034,7 +4035,7 @@ def maxid_layer(input, name=None, layer_attr=None): ...@@ -4034,7 +4035,7 @@ def maxid_layer(input, name=None, layer_attr=None):
maxid = maxid_layer(input=layer) maxid = maxid_layer(input=layer)
:param input: Input layer name. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
...@@ -4112,7 +4113,7 @@ def eos_layer(input, eos_id, name=None, layer_attr=None): ...@@ -4112,7 +4113,7 @@ def eos_layer(input, eos_id, name=None, layer_attr=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: Input layer name. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param eos_id: end id of sequence :param eos_id: end id of sequence
:type eos_id: int :type eos_id: int
...@@ -4504,7 +4505,7 @@ def conv_projection(input, ...@@ -4504,7 +4505,7 @@ def conv_projection(input,
num_filters=64, num_filters=64,
num_channels=64) num_channels=64)
:param input: input layer :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param filter_size: The x dimension of a filter kernel. :param filter_size: The x dimension of a filter kernel.
:type filter_size: int :type filter_size: int
...@@ -4529,7 +4530,7 @@ def conv_projection(input, ...@@ -4529,7 +4530,7 @@ def conv_projection(input,
:param param_attr: Convolution param attribute. None means default attribute :param param_attr: Convolution param attribute. None means default attribute
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param trans: whether it is convTrans or conv :param trans: whether it is convTrans or conv
:type trans: boolean :type trans: bool
:return: A DotMulProjection Object. :return: A DotMulProjection Object.
:rtype: DotMulProjection :rtype: DotMulProjection
""" """
...@@ -4637,14 +4638,14 @@ def pad_layer(input, ...@@ -4637,14 +4638,14 @@ def pad_layer(input,
pad_h=[0,0], pad_h=[0,0],
pad_w=[2,2]) pad_w=[2,2])
:param input: layer's input. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param pad_c: padding size in channel dimension. :param pad_c: padding size in channel dimension.
:type pad_c: list|None :type pad_c: list | None
:param pad_h: padding size in height dimension. :param pad_h: padding size in height dimension.
:type pad_h: list|None :type pad_h: list | None
:param pad_w: padding size in width dimension. :param pad_w: padding size in width dimension.
:type pad_w: list|None :type pad_w: list | None
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
...@@ -4779,7 +4780,7 @@ def tensor_layer(a, ...@@ -4779,7 +4780,7 @@ def tensor_layer(a,
:type b: LayerOutput :type b: LayerOutput
:param size: the layer dimension. :param size: the layer dimension.
:type size: int. :type size: int.
:param act: Activation Type. Default is tanh. :param act: Activation type. LinearActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param param_attr: The Parameter Attribute. :param param_attr: The Parameter Attribute.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
...@@ -4787,9 +4788,9 @@ def tensor_layer(a, ...@@ -4787,9 +4788,9 @@ def tensor_layer(a,
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -4836,15 +4837,15 @@ def selective_fc_layer(input, ...@@ -4836,15 +4837,15 @@ def selective_fc_layer(input,
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput|list|tuple :type input: LayerOutput | list | tuple
:param select: The select layer. The output of select layer should be a :param select: The select layer. The output of select layer should be a
sparse binary matrix, and treat as the mask of selective fc. sparse binary matrix, and treat as the mask of selective fc.
If is None, acts exactly like fc_layer. If is None, acts exactly like fc_layer.
:type select: LayerOutput :type select: LayerOutput
:param size: The layer dimension. :param size: The layer dimension.
:type size: int :type size: int
:param act: Activation Type. Default is tanh. :param act: Activation type. TanhActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param param_attr: The Parameter Attribute. :param param_attr: The Parameter Attribute.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
...@@ -4852,9 +4853,9 @@ def selective_fc_layer(input, ...@@ -4852,9 +4853,9 @@ def selective_fc_layer(input,
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -4906,12 +4907,12 @@ def sampling_id_layer(input, name=None, layer_attr=None): ...@@ -4906,12 +4907,12 @@ def sampling_id_layer(input, name=None, layer_attr=None):
samping_id = sampling_id_layer(input=input) samping_id = sampling_id_layer(input=input)
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -4944,7 +4945,7 @@ def slope_intercept_layer(input, ...@@ -4944,7 +4945,7 @@ def slope_intercept_layer(input,
scale = slope_intercept_layer(input=input, slope=-1.0, intercept=1.0) scale = slope_intercept_layer(input=input, slope=-1.0, intercept=1.0)
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
...@@ -4953,7 +4954,7 @@ def slope_intercept_layer(input, ...@@ -4953,7 +4954,7 @@ def slope_intercept_layer(input,
:param intercept: the offset. :param intercept: the offset.
:type intercept: float. :type intercept: float.
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -5013,7 +5014,7 @@ def linear_comb_layer(weights, vectors, size=None, name=None, layer_attr=None): ...@@ -5013,7 +5014,7 @@ def linear_comb_layer(weights, vectors, size=None, name=None, layer_attr=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -5077,10 +5078,10 @@ def block_expand_layer(input, ...@@ -5077,10 +5078,10 @@ def block_expand_layer(input,
block_x=1, block_x=1,
block_x=3) block_x=3)
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param num_channels: The channel number of input layer. :param num_channels: The channel number of input layer.
:type num_channels: int|None :type num_channels: int | None
:param block_x: The width of sub block. :param block_x: The width of sub block.
:type block_x: int :type block_x: int
:param block_y: The width of sub block. :param block_y: The width of sub block.
...@@ -5094,9 +5095,9 @@ def block_expand_layer(input, ...@@ -5094,9 +5095,9 @@ def block_expand_layer(input,
:param padding_y: The padding size in vertical direction. :param padding_y: The padding size in vertical direction.
:type padding_y: int :type padding_y: int
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring. :type name: None | basestring.
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -5155,15 +5156,15 @@ def maxout_layer(input, groups, num_channels=None, name=None, layer_attr=None): ...@@ -5155,15 +5156,15 @@ def maxout_layer(input, groups, num_channels=None, name=None, layer_attr=None):
num_channels=128, num_channels=128,
groups=4) groups=4)
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param num_channels: The channel number of input layer. If None will be set :param num_channels: The channel number of input layer. If None will be set
automatically from previous output. automatically from previous output.
:type num_channels: int|None :type num_channels: int | None
:param groups: The group number of input layer. :param groups: The group number of input layer.
:type groups: int :type groups: int
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring. :type name: None | basestring.
:param layer_attr: Extra Layer attribute. :param layer_attr: Extra Layer attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:return: LayerOutput object. :return: LayerOutput object.
...@@ -5220,18 +5221,18 @@ def ctc_layer(input, ...@@ -5220,18 +5221,18 @@ def ctc_layer(input,
size=9055, size=9055,
norm_by_times=True) norm_by_times=True)
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param label: The data layer of label with variable length. :param label: The data layer of label with variable length.
:type label: LayerOutput :type label: LayerOutput
:param size: category numbers + 1. :param size: category numbers + 1.
:type size: int :type size: int
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring|None :type name: basestring | None
:param norm_by_times: Whether to normalization by times. False by default. :param norm_by_times: Whether to normalization by times. False by default.
:type norm_by_times: bool :type norm_by_times: bool
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -5297,20 +5298,20 @@ def warp_ctc_layer(input, ...@@ -5297,20 +5298,20 @@ def warp_ctc_layer(input,
blank=1000, blank=1000,
norm_by_times=False) norm_by_times=False)
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param label: The data layer of label with variable length. :param label: The data layer of label with variable length.
:type label: LayerOutput :type label: LayerOutput
:param size: category numbers + 1. :param size: category numbers + 1.
:type size: int :type size: int
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring|None :type name: basestring | None
:param blank: the 'blank' label used in ctc :param blank: the 'blank' label used in ctc
:type blank: int :type blank: int
:param norm_by_times: Whether to normalization by times. False by default. :param norm_by_times: Whether to normalization by times. False by default.
:type norm_by_times: bool :type norm_by_times: bool
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -5368,11 +5369,11 @@ def crf_layer(input, ...@@ -5368,11 +5369,11 @@ def crf_layer(input,
:param param_attr: Parameter attribute. None means default attribute :param param_attr: Parameter attribute. None means default attribute
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring :type name: None | basestring
:param coeff: The coefficient affects the gradient in the backward. :param coeff: The coefficient affects the gradient in the backward.
:type coeff: float :type coeff: float
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -5438,9 +5439,9 @@ def crf_decoding_layer(input, ...@@ -5438,9 +5439,9 @@ def crf_decoding_layer(input,
:param param_attr: Parameter attribute. None means default attribute :param param_attr: Parameter attribute. None means default attribute
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring :type name: None | basestring
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -5499,14 +5500,14 @@ def nce_layer(input, ...@@ -5499,14 +5500,14 @@ def nce_layer(input,
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layers. It could be a LayerOutput of list/tuple of LayerOutput. :param input: The input layers. It could be a LayerOutput of list/tuple of LayerOutput.
:type input: LayerOutput|list|tuple|collections.Sequence :type input: LayerOutput | list | tuple | collections.Sequence
:param label: label layer :param label: label layer
:type label: LayerOutput :type label: LayerOutput
:param weight: weight layer, can be None(default) :param weight: weight layer, can be None(default)
:type weight: LayerOutput :type weight: LayerOutput
:param num_classes: number of classes. :param num_classes: number of classes.
:type num_classes: int :type num_classes: int
:param act: Activation, default is Sigmoid. :param act: Activation type. SigmoidActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param param_attr: The Parameter Attribute|list. :param param_attr: The Parameter Attribute|list.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
...@@ -5515,12 +5516,12 @@ def nce_layer(input, ...@@ -5515,12 +5516,12 @@ def nce_layer(input,
:param neg_distribution: The distribution for generating the random negative labels. :param neg_distribution: The distribution for generating the random negative labels.
A uniform distribution will be used if not provided. A uniform distribution will be used if not provided.
If not None, its length must be equal to num_classes. If not None, its length must be equal to num_classes.
:type neg_distribution: list|tuple|collections.Sequence|None :type neg_distribution: list | tuple | collections.Sequence | None
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:return: layer name. :return: layer name.
...@@ -5636,7 +5637,7 @@ def rank_cost(left, ...@@ -5636,7 +5637,7 @@ def rank_cost(left,
It is an optional argument. It is an optional argument.
:type weight: LayerOutput :type weight: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring :type name: None | basestring
:param coeff: The coefficient affects the gradient in the backward. :param coeff: The coefficient affects the gradient in the backward.
:type coeff: float :type coeff: float
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
...@@ -5701,7 +5702,7 @@ def lambda_cost(input, ...@@ -5701,7 +5702,7 @@ def lambda_cost(input,
entire list of get gradient. entire list of get gradient.
:type max_sort_size: int :type max_sort_size: int
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring :type name: None | basestring
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:return: LayerOutput object. :return: LayerOutput object.
...@@ -5745,7 +5746,7 @@ def cross_entropy(input, ...@@ -5745,7 +5746,7 @@ def cross_entropy(input,
:param label: The input label. :param label: The input label.
:type input: LayerOutput. :type input: LayerOutput.
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring. :type name: None | basestring.
:param coeff: The cost is multiplied with coeff. :param coeff: The cost is multiplied with coeff.
The coefficient affects the gradient in the backward. The coefficient affects the gradient in the backward.
:type coeff: float. :type coeff: float.
...@@ -5793,7 +5794,7 @@ def cross_entropy_with_selfnorm(input, ...@@ -5793,7 +5794,7 @@ def cross_entropy_with_selfnorm(input,
:param label: The input label. :param label: The input label.
:type input: LayerOutput. :type input: LayerOutput.
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring. :type name: None | basestring.
:param coeff: The coefficient affects the gradient in the backward. :param coeff: The coefficient affects the gradient in the backward.
:type coeff: float. :type coeff: float.
:param softmax_selfnorm_alpha: The scale factor affects the cost. :param softmax_selfnorm_alpha: The scale factor affects the cost.
...@@ -5830,10 +5831,10 @@ def sum_cost(input, name=None, layer_attr=None): ...@@ -5830,10 +5831,10 @@ def sum_cost(input, name=None, layer_attr=None):
cost = sum_cost(input=input_layer) cost = sum_cost(input=input_layer)
:param input: The first input layer. :param input: The input of this layer.
:type input: LayerOutput. :type input: LayerOutput.
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring. :type name: None | basestring.
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute :type layer_attr: ExtraLayerAttribute
:return: LayerOutput object. :return: LayerOutput object.
...@@ -5878,7 +5879,7 @@ def huber_regression_cost(input, ...@@ -5878,7 +5879,7 @@ def huber_regression_cost(input,
:param label: The input label. :param label: The input label.
:type input: LayerOutput. :type input: LayerOutput.
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring. :type name: None | basestring.
:param delta: The difference between the observed and predicted values. :param delta: The difference between the observed and predicted values.
:type delta: float. :type delta: float.
:param coeff: The coefficient affects the gradient in the backward. :param coeff: The coefficient affects the gradient in the backward.
...@@ -5928,7 +5929,7 @@ def huber_classification_cost(input, ...@@ -5928,7 +5929,7 @@ def huber_classification_cost(input,
:param label: The input label. :param label: The input label.
:type input: LayerOutput. :type input: LayerOutput.
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring. :type name: None | basestring.
:param coeff: The coefficient affects the gradient in the backward. :param coeff: The coefficient affects the gradient in the backward.
:type coeff: float. :type coeff: float.
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
...@@ -5971,7 +5972,7 @@ def multi_binary_label_cross_entropy(input, ...@@ -5971,7 +5972,7 @@ def multi_binary_label_cross_entropy(input,
:param label: The input label. :param label: The input label.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring :type name: None | basestring
:param coeff: The coefficient affects the gradient in the backward. :param coeff: The coefficient affects the gradient in the backward.
:type coeff: float :type coeff: float
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
...@@ -6139,7 +6140,7 @@ def smooth_l1_cost(input, label, name=None, coeff=1.0, layer_attr=None): ...@@ -6139,7 +6140,7 @@ def smooth_l1_cost(input, label, name=None, coeff=1.0, layer_attr=None):
:param label: The input label. :param label: The input label.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: None|basestring :type name: None | basestring
:param coeff: The coefficient affects the gradient in the backward. :param coeff: The coefficient affects the gradient in the backward.
:type coeff: float :type coeff: float
:param layer_attr: Extra Layer Attribute. :param layer_attr: Extra Layer Attribute.
...@@ -6226,7 +6227,7 @@ def dropout_layer(input, dropout_rate, name=None): ...@@ -6226,7 +6227,7 @@ def dropout_layer(input, dropout_rate, name=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param dropout_rate: The probability of dropout. :param dropout_rate: The probability of dropout.
:type dropout_rate: float :type dropout_rate: float
...@@ -6285,18 +6286,18 @@ def row_conv_layer(input, ...@@ -6285,18 +6286,18 @@ def row_conv_layer(input,
row_conv = row_conv_layer(input=input_layer, context_len=3) row_conv = row_conv_layer(input=input_layer, context_len=3)
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param context_len: The context length equals the lookahead step number :param context_len: The context length equals the lookahead step number
plus one. plus one.
:type context_len: int :type context_len: int
:param act: Activation Type. Default is linear activation. :param act: Activation Type. LinearActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param param_attr: The Parameter Attribute. If None, the parameter will be :param param_attr: The Parameter Attribute. If None, the parameter will be
initialized smartly. It's better to set it by yourself. initialized smartly. It's better to set it by yourself.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param layer_attr: Extra Layer config. :param layer_attr: Extra Layer config.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
...@@ -6342,7 +6343,7 @@ def prelu_layer(input, ...@@ -6342,7 +6343,7 @@ def prelu_layer(input,
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param partial_sum: this parameter makes a group of inputs share a same weight. :param partial_sum: this parameter makes a group of inputs share a same weight.
...@@ -6352,9 +6353,9 @@ def prelu_layer(input, ...@@ -6352,9 +6353,9 @@ def prelu_layer(input,
:type partial_sum: int :type partial_sum: int
:param param_attr: The parameter attribute. See ParameterAttribute for details. :param param_attr: The parameter attribute. See ParameterAttribute for details.
:type param_attr: ParameterAttribute|None :type param_attr: ParameterAttribute | None
:param layer_attr: Extra layer configurations. Default is None. :param layer_attr: Extra layer configurations. Default is None.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -6407,37 +6408,37 @@ def gated_unit_layer(input, ...@@ -6407,37 +6408,37 @@ def gated_unit_layer(input,
.. code-block:: python .. code-block:: python
gated_unit = gated_unit_layer(size=128, input=input_layer)) gated_unit = gated_unit_layer(size=128, input=input_layer))
:param input: input for this layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param size: output size of the gated unit. :param size: output size of the gated unit.
:type size: int :type size: int
:param act: activation type of the projected input. :param act: Activation type of the projected input. LinearActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param gate_attr: Attributes to tune the gate output, for example, error :param gate_attr: Attributes to tune the gate output, for example, error
clipping threshold, dropout and so on. See ExtraLayerAttribute for clipping threshold, dropout and so on. See ExtraLayerAttribute for
more details. more details.
:type gate_attr: ExtraLayerAttribute|None :type gate_attr: ExtraLayerAttribute | None
:param gate_param_attr: Attributes to tune the learnable projected matrix :param gate_param_attr: Attributes to tune the learnable projected matrix
parameter of the gate. parameter of the gate.
:type gate_param_attr: ParameterAttribute|None :type gate_param_attr: ParameterAttribute | None
:param gate_bias_attr: Attributes to tune the learnable bias of the gate. :param gate_bias_attr: Attributes to tune the learnable bias of the gate.
:type gate_bias_attr: ParameterAttribute|None :type gate_bias_attr: ParameterAttribute | None
:param inproj_attr: Attributes to the tune the projected input, for :param inproj_attr: Attributes to the tune the projected input, for
example, error clipping threshold, dropout and so on. See example, error clipping threshold, dropout and so on. See
ExtraLayerAttribute for more details. ExtraLayerAttribute for more details.
:type inproj_attr: ExtraLayerAttribute|None :type inproj_attr: ExtraLayerAttribute | None
:param inproj_param_attr: Attributes to tune the learnable parameter of :param inproj_param_attr: Attributes to tune the learnable parameter of
the projection of input. the projection of input.
:type inproj_param_attr: ParameterAttribute|None :type inproj_param_attr: ParameterAttribute | None
:param inproj_bias_attr: Attributes to tune the learnable bias of :param inproj_bias_attr: Attributes to tune the learnable bias of
projection of the input. projection of the input.
:type inproj_bias_attr: ParameterAttribute|None :type inproj_bias_attr: ParameterAttribute | None
:param layer_attr: Attributes to tune the final output of the gated unit, :param layer_attr: Attributes to tune the final output of the gated unit,
for example, error clipping threshold, dropout and so on. See for example, error clipping threshold, dropout and so on. See
ExtraLayerAttribute for more details. ExtraLayerAttribute for more details.
:type layer_attr: ExtraLayerAttribute|None :type layer_attr: ExtraLayerAttribute | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -6487,7 +6488,7 @@ def switch_order_layer(input, ...@@ -6487,7 +6488,7 @@ def switch_order_layer(input,
switch = switch_order(input=layer, name='switch', reshape_axis=reshape_axis) switch = switch_order(input=layer, name='switch', reshape_axis=reshape_axis)
reshape = {'height':[ 0, 1, 2], 'width':[3]} reshape = {'height':[ 0, 1, 2], 'width':[3]}
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
...@@ -6521,7 +6522,7 @@ def switch_order_layer(input, ...@@ -6521,7 +6522,7 @@ def switch_order_layer(input,
@layer_support() @layer_support()
def crop_layer(input, offset, axis=2, shape=None, name=None, layer_attr=None): def crop_layer(input, offset, axis=2, shape=None, name=None, layer_attr=None):
""" """
The crop layer crops images by offset and shape. User can set crop shape by This layer crops images by offset and shape. User can set crop shape by
args 'shape' explicitly or by reference input layer. args 'shape' explicitly or by reference input layer.
The example usage is: The example usage is:
...@@ -6529,10 +6530,10 @@ def crop_layer(input, offset, axis=2, shape=None, name=None, layer_attr=None): ...@@ -6529,10 +6530,10 @@ def crop_layer(input, offset, axis=2, shape=None, name=None, layer_attr=None):
.. code-block:: python .. code-block:: python
crop = crop_layer(input=[image_input, reference_input], axis=2, offset=[2, 3]) crop = crop_layer(input=[image_input, reference_input], axis=2, offset=[2, 3])
:param input: The input layer.If two inputs were setted, :param input: The input of this layer. If two inputs are given, the second input
the second input will be regarded as reference input will be regarded as reference input.
:type input: LayerOutput or Sequence :type input: LayerOutput | Sequence
:param offset: The crop offset :param offset: The crop offset.
:type offset: Sequence :type offset: Sequence
:param axis: start axis to be cropped. To image input layer: :param axis: start axis to be cropped. To image input layer:
- 0: batch size - 0: batch size
...@@ -6581,12 +6582,12 @@ def sub_nested_seq_layer(input, selected_indices, name=None): ...@@ -6581,12 +6582,12 @@ def sub_nested_seq_layer(input, selected_indices, name=None):
.. code-block:: python .. code-block:: python
sub_nest_seq = sub_nested_seq_layer(input=[data, selected_indices]) sub_nest_seq = sub_nested_seq_layer(input=data, selected_indices=selected_ids)
:param input: A nested sequence. :param input: The input of this layer. It is a nested sequence.
:type input: LayerOutput :type input: LayerOutput
:param selected_indices: a set of sequence indices in the nested sequence. :param selected_indices: A set of sequence indices in the nested sequence.
:type input: LayerOutput :type input: LayerOutput
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
...@@ -6628,7 +6629,7 @@ def clip_layer(input, min, max, name=None): ...@@ -6628,7 +6629,7 @@ def clip_layer(input, min, max, name=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput. :type input: LayerOutput.
:param min: The lower threshold for clipping. :param min: The lower threshold for clipping.
:type min: double :type min: double
...@@ -6673,12 +6674,12 @@ def seq_slice_layer(input, starts, ends, name=None): ...@@ -6673,12 +6674,12 @@ def seq_slice_layer(input, starts, ends, name=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: input for this layer, it should be a sequence. :param input: The input of this layer, which should be a sequence.
:type input: LayerOutput :type input: LayerOutput
:param starts: start indices to slice the input sequence. :param starts: start indices to slice the input sequence.
:type starts: LayerOutput|None :type starts: LayerOutput | None
:param ends: end indices to slice the input sequence. :param ends: end indices to slice the input sequence.
:type ends: LayerOutput|None :type ends: LayerOutput | None
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
...@@ -6727,9 +6728,9 @@ def kmax_seq_score_layer(input, name=None, beam_size=1): ...@@ -6727,9 +6728,9 @@ def kmax_seq_score_layer(input, name=None, beam_size=1):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. It stores scores over a sequence or a nested :param input: The input of this layer. It stores scores over a sequence or a nested
sequence and its size must be 1. sequence and its size must be 1.
:type input: LayerOutput. :type input: LayerOutput
:param beam_size: sequence indices with top beam_size scores are returned. :param beam_size: sequence indices with top beam_size scores are returned.
:type beam_size: double :type beam_size: double
:return: LayerOutput object. :return: LayerOutput object.
...@@ -6785,24 +6786,24 @@ def img_conv3d_layer(input, ...@@ -6785,24 +6786,24 @@ def img_conv3d_layer(input,
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: Layer Input. :param input: The input of this layer.
:type input: LayerOutput :type input: LayerOutput
:param filter_size: The x dimension of a filter kernel. Or input a list. :param filter_size: The x dimension of a filter kernel. Or input a list.
:type filter_size: int|tuple|list :type filter_size: int | tuple | list
:param num_filters: Each filter group's number of filter :param num_filters: Each filter group's number of filter
:param act: Activation type. Default is tanh :param act: Activation type. ReluActivation is the default.
:type act: BaseActivation :type act: BaseActivation
:param groups: Group size of filters. :param groups: Group size of filters.
:type groups: int :type groups: int
:param stride: The x dimension of the stride. Or input a tuple for two image :param stride: The x dimension of the stride. Or input a tuple for two image
dimension. dimension.
:type stride: int|tuple|list :type stride: int | tuple | list
:param padding: The x dimension of the padding. Or input a tuple for two :param padding: The x dimension of the padding. Or input a tuple for two
image dimension image dimension
:type padding: int|tuple|list :type padding: int | tuple | list
:param bias_attr: Convolution bias attribute. None means default bias. :param bias_attr: Convolution bias attribute. None means default bias.
False means no bias. False means no bias.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:param num_channels: number of input channels. If None will be set :param num_channels: number of input channels. If None will be set
automatically from previous output. automatically from previous output.
:type num_channels: int :type num_channels: int
...@@ -6916,15 +6917,15 @@ def scale_shift_layer(input, name=None, param_attr=None, bias_attr=None): ...@@ -6916,15 +6917,15 @@ def scale_shift_layer(input, name=None, param_attr=None, bias_attr=None):
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param input: The input layer. :param input: The input of this layer.
:type input: LayerOutput. :type input: LayerOutput
:param param_attr: The parameter attribute of scaling. :param param_attr: The parameter attribute of scaling.
:type param_attr: ParameterAttribute :type param_attr: ParameterAttribute
:param bias_attr: The Bias Attribute. If the parameter is set to :param bias_attr: The Bias Attribute. If the parameter is set to
False or something not type of ParameterAttribute, False or something not type of ParameterAttribute,
no bias is defined. If the parameter is set to no bias is defined. If the parameter is set to
True, the bias is initialized to zero. True, the bias is initialized to zero.
:type bias_attr: ParameterAttribute|None|Bool|Any :type bias_attr: ParameterAttribute | None | bool | Any
:return: LayerOutput object. :return: LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
""" """
...@@ -6944,11 +6945,11 @@ def resize_layer(input, size, name=None): ...@@ -6944,11 +6945,11 @@ def resize_layer(input, size, name=None):
into the output matrix with a shape of [Height x Width / size, size], into the output matrix with a shape of [Height x Width / size, size],
where size is the parameter of this layer indicating the output dimension. where size is the parameter of this layer indicating the output dimension.
:param input: The input to this layer. :param input: The input of this layer.
:type input: LayerOutput. :type input: LayerOutput.
:param name: The name of this layer. It is optional. :param name: The name of this layer. It is optional.
:type name: basestring :type name: basestring
:param size: The resized output dimesion of this layer. :param size: The resized output dimension of this layer.
:type size: int :type size: int
:return: A LayerOutput object. :return: A LayerOutput object.
:rtype: LayerOutput :rtype: LayerOutput
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册