Skip to content

Commit 8c58237

Browse files
author
chengduozh
committed
update parameter doc
test=develop
1 parent 16822da commit 8c58237

File tree

2 files changed

+51
-31
lines changed

2 files changed

+51
-31
lines changed

python/paddle/fluid/layers/nn.py

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,12 +1277,15 @@ def sequence_conv(input,
12771277
filter_size (int): the filter size (H and W).
12781278
filter_stride (int): stride of the filter.
12791279
padding (bool): if True, add paddings.
1280-
bias_attr (ParamAttr): The parameter attribute for the bias of this layer.
1280+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias of sequence_conv.
12811281
If it is set to False, no bias will be added to the output units.
1282-
If it is set to None, the bias is initialized zero. Default: None.
1282+
If it is set to None or one attribute of ParamAttr, sequence_conv
1283+
will create ParamAttr as bias_attr. If the Initializer of the bias_attr
1284+
is not set, the bias is initialized zero. Default: None.
12831285
param_attr (ParamAttr): The parameter attribute for learnable parameters/weights
1284-
of this layer. If it is set to None, the parameter is initialized with
1285-
Xavier. Default: None.
1286+
of sequence_conv. If it is set to None or one attribute of ParamAttr, sequence_conv
1287+
will create ParamAttr as param_attr. If the Initializer of the param_attr
1288+
is not set, the parameter is initialized with Xavier. Default: None.
12861289
act (str): the activation type
12871290
12881291
Returns:
@@ -1491,14 +1494,17 @@ def conv2d(input,
14911494
convolution in Alex Krizhevsky's Deep CNN paper: when group=2,
14921495
the first half of the filters is only connected to the first half
14931496
of the input channels, while the second half of the filters is only
1494-
connected to the second half of the input channels. Default: groups=1
1497+
connected to the second half of the input channels. Default: groups=1.
14951498
param_attr (ParamAttr): The parameter attribute for learnable parameters/weights
1496-
of this layer. If it is set to None, the parameter is initialized with
1497-
:math:`Normal(0.0, std)`, and the :math:`std` is :math:`(\\frac{2.0 }{filter\_elem\_num})^{0.5}`.
1498-
Default: None.
1499-
bias_attr (ParamAttr): The parameter attribute for the bias of this layer.
1499+
of conv2d. If it is set to None or one attribute of ParamAttr, conv2d
1500+
will create ParamAttr as param_attr. If the Initializer of the param_attr
1501+
is not set, the parameter is initialized with :math:`Normal(0.0, std)`,
1502+
and the :math:`std` is :math:`(\\frac{2.0 }{filter\_elem\_num})^{0.5}`. Default: None.
1503+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias of conv2d.
15001504
If it is set to False, no bias will be added to the output units.
1501-
If it is set to None, the bias is initialized zero. Default: None.
1505+
If it is set to None or one attribute of ParamAttr, conv2d
1506+
will create ParamAttr as bias_attr. If the Initializer of the bias_attr
1507+
is not set, the bias is initialized zero. Default: None.
15021508
use_cudnn (bool): Use cudnn kernel or not, it is valid only when the cudnn
15031509
library is installed. Default: True
15041510
act (str): Activation type, if it is set to None, activation is not appended.
@@ -1550,8 +1556,8 @@ def conv2d(input,
15501556
filter_shape = [num_filters, int(num_filter_channels)] + filter_size
15511557

15521558
def _get_default_param_initializer():
1553-
filter_num_elem = filter_size[0] * filter_size[1] * num_channels
1554-
std = (2.0 / (filter_num_elem))**0.5
1559+
filter_elem_num = filter_size[0] * filter_size[1] * num_channels
1560+
std = (2.0 / filter_elem_num)**0.5
15551561
return Normal(0.0, std, 0)
15561562

15571563
filter_param = helper.create_parameter(
@@ -1663,12 +1669,15 @@ def conv3d(input,
16631669
of the input channels, while the second half of the filters is only
16641670
connected to the second half of the input channels. Default: groups=1
16651671
param_attr (ParamAttr): The parameter attribute for learnable parameters/weights
1666-
of this layer. If it is set to None, the parameter is initialized with
1667-
:math:`Normal(0.0, std)`, and the :math:`std` is :math:`(\\frac{2.0 }{filter\_elem\_num})^{0.5}`.
1668-
Default: None.
1669-
bias_attr (ParamAttr): The parameter attribute for the bias of this layer.
1672+
of conv3d. If it is set to None or one attribute of ParamAttr, conv3d
1673+
will create ParamAttr as param_attr. If it is set to None, the parameter
1674+
is initialized with :math:`Normal(0.0, std)`, and the :math:`std` is
1675+
:math:`(\\frac{2.0 }{filter\_elem\_num})^{0.5}`. Default: None.
1676+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias of conv3d.
16701677
If it is set to False, no bias will be added to the output units.
1671-
If it is set to None, the bias is initialized zero. Default: None.
1678+
If it is set to None or one attribute of ParamAttr, conv3d
1679+
will create ParamAttr as bias_attr. If the Initializer of the bias_attr
1680+
is not set, the bias is initialized zero. Default: None.
16721681
use_cudnn (bool): Use cudnn kernel or not, it is valid only when the cudnn
16731682
library is installed. Default: True
16741683
act (str): Activation type, if it is set to None, activation is not appended.
@@ -2413,11 +2422,14 @@ def conv2d_transpose(input,
24132422
filters is only connected to the second half of the input channels.
24142423
Default: groups = 1.
24152424
param_attr (ParamAttr): The parameter attribute for learnable parameters/weights
2416-
of this layer. If it is set to None, the parameter is initialized with
2417-
Xavier. Default: None.
2418-
bias_attr (ParamAttr): The parameter attribute for the bias of this layer.
2425+
of conv2d_transpose. If it is set to None or one attribute of ParamAttr, conv2d_transpose
2426+
will create ParamAttr as param_attr. If the Initializer of the param_attr
2427+
is not set, the parameter is initialized with Xavier. Default: None.
2428+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias of conv2d_transpose.
24192429
If it is set to False, no bias will be added to the output units.
2420-
If it is set to None, the bias is initialized zero. Default: None.
2430+
If it is set to None or one attribute of ParamAttr, conv2d_transpose
2431+
will create ParamAttr as bias_attr. If the Initializer of the bias_attr
2432+
is not set, the bias is initialized zero. Default: None.
24212433
use_cudnn(bool): Use cudnn kernel or not, it is valid only when the cudnn
24222434
library is installed. Default: True.
24232435
act (str): Activation type, if it is set to None, activation is not appended.
@@ -2598,11 +2610,14 @@ def conv3d_transpose(input,
25982610
filters is only connected to the second half of the input channels.
25992611
Default: groups=1
26002612
param_attr (ParamAttr): The parameter attribute for learnable parameters/weights
2601-
of this layer. If it is set to None, the parameter is initialized with
2602-
Xavier. Default: None.
2603-
bias_attr (ParamAttr): The parameter attribute for the bias of this layer.
2613+
of conv3d_transpose. If it is set to None or one attribute of ParamAttr, conv3d_transpose
2614+
will create ParamAttr as param_attr. If the Initializer of the param_attr
2615+
is not set, the parameter is initialized with Xavier. Default: None.
2616+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias of conv3d_transpose.
26042617
If it is set to False, no bias will be added to the output units.
2605-
If it is set to None, the bias is initialized zero. Default: None.
2618+
If it is set to None or one attribute of ParamAttr, conv3d_transpose
2619+
will create ParamAttr as bias_attr. If the Initializer of the bias_attr
2620+
is not set, the bias is initialized zero. Default: None.
26062621
use_cudnn(bool): Use cudnn kernel or not, it is valid only when the cudnn
26072622
library is installed. Default: True
26082623
act (str): Activation type, if it is set to None, activation is not appended.

python/paddle/fluid/nets.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,20 @@ def simple_img_conv_pool(input,
7777
convolution in Alex Krizhevsky's Deep CNN paper: when group=2,
7878
the first half of the filters is only connected to the first half
7979
of the input channels, while the second half of the filters is only
80-
connected to the second half of the input channels. Default: groups=1
80+
connected to the second half of the input channels. Default: groups=1.
8181
param_attr (ParamAttr): The parameter attribute for learnable parameters/weights
82-
of conv2d. If it is set to None, the parameter is initialized with
83-
:math:`Normal(0.0, std)`, and the :math:`std` is :math:`(\\frac{2.0 }{filter\_elem\_num})^{0.5}`.
82+
of conv2d. If it is set to None or one attribute of ParamAttr, conv2d
83+
will create ParamAttr as param_attr. If the Initializer of the param_attr
84+
is not set, the parameter is initialized with :math:`Normal(0.0, std)`,
85+
and the :math:`std` is :math:`(\\frac{2.0 }{filter\_elem\_num})^{0.5}`.
8486
Default: None.
85-
bias_attr (ParamAttr): The parameter attribute for the bias of conv2d.
87+
bias_attr (ParamAttr|bool|None): The parameter attribute for the bias of conv2d.
8688
If it is set to False, no bias will be added to the output units.
87-
If it is set to None, the bias is initialized zero. Default: None.
88-
act (str): Activation type for Conv2d. Default: None
89+
If it is set to None or one attribute of ParamAttr, conv2d
90+
will create ParamAttr as bias_attr. If the Initializer of the bias_attr
91+
is not set, the bias is initialized zero. Default: None.
92+
act (str): Activation type for conv2d, if it is set to None, activation is not
93+
appended. Default: None.
8994
use_cudnn (bool): Use cudnn kernel or not, it is valid only when the cudnn
9095
library is installed. Default: True
9196

0 commit comments

Comments
 (0)