Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
51c75a93
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
51c75a93
编写于
11月 20, 2017
作者:
R
ranqiu92
提交者:
GitHub
11月 20, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5742 from ranqiu92/doc
Update annotations of layers.py
上级
55bee85e
b0c88e3d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
103 addition
and
70 deletion
+103
-70
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+103
-70
未找到文件。
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
51c75a93
...
@@ -2507,12 +2507,12 @@ def img_conv_layer(input,
...
@@ -2507,12 +2507,12 @@ def img_conv_layer(input,
input is raw pixels of image(mono or RGB), or it may be the previous layer's
input is raw pixels of image(mono or RGB), or it may be the previous layer's
num_filters * num_group.
num_filters * num_group.
There are several group
of filter
in PaddlePaddle implementation.
There are several group
s of filters
in PaddlePaddle implementation.
Each group will process some channel
of the inputs. For example, if an input
Each group will process some channel
s of the input. For example, if
num_channel = 256, group = 4, num_filter=32, the PaddlePaddle will create
num_channel = 256, group = 4, num_filter=32, the PaddlePaddle will create
32*4 = 128 filters to process
inputs
. The channels will be split into 4
32*4 = 128 filters to process
the input
. The channels will be split into 4
pieces. First 256/4 = 64 channels will
process
by first 32 filters. The
pieces. First 256/4 = 64 channels will
be processed
by first 32 filters. The
rest channels will be processed by
rest group
of filters.
rest channels will be processed by
the rest groups
of filters.
The example usage is:
The example usage is:
...
@@ -2528,53 +2528,68 @@ def img_conv_layer(input,
...
@@ -2528,53 +2528,68 @@ def img_conv_layer(input,
:type name: basestring
:type name: basestring
:param input: The input of this layer.
: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 dimensions of the filter kernel. If the parameter is
two image dimension.
set to one integer, the two dimensions on x and y axises
will be same when filter_size_y is not set. If it is set
to a list, the first element indicates the dimension on
the x axis, and the second is used to specify the dimension
on the y axis when filter_size_y is not provided.
: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 dimension of the filter kernel on the y axis. If the parameter
currently supports rectangular filters, the filter's
is not set, it will be set automatically according to filter_size.
shape will be (filter_size, filter_size_y).
:type filter_size_y: int
: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. ReluActivation is the default activation.
:param act: Activation type. ReluActivation is the default activation.
:type act: BaseActivation
:type act: BaseActivation
:param groups:
Group size of filters
.
:param groups:
The group number. 1 is the default group number
.
:type groups: int
:type groups: int
:param stride: The x dimension of the stride. Or input a tuple for two image
:param stride: The strides. If the parameter is set to one integer, the strides
dimension.
on x and y axises will be same when stride_y is not set. If it is
set to a list, the first element indicates the stride on the x axis,
and the second is used to specify the stride on the y axis when
stride_y is not provided. 1 is the default value.
:type stride: int | tuple | list
:type stride: int | tuple | list
:param stride_y: The
y dimension of the stride
.
:param stride_y: The
stride on the y axis
.
: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 padding sizes. If the parameter is set to one integer, the padding
image dimension
sizes on x and y axises will be same when padding_y is not set. If it
is set to a list, the first element indicates the padding size on the
x axis, and the second is used to specify the padding size on the y axis
when padding_y is not provided. 0 is the default padding size.
:type padding: int | tuple | list
:type padding: int | tuple | list
:param padding_y: The
y dimension of the padding
.
:param padding_y: The
padding size on the y axis
.
: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 dimensions of the dilation. If the parameter is set to one integer,
image dimension
the two dimensions on x and y axises will be same when dilation_y is not
set. If it is set to a list, the first element indicates the dimension
on the x axis, and the second is used to specify the dimension on the y
axis when dilation_y is not provided. 1 is the default dimension.
:type dilation: int | tuple | list
:type dilation: int | tuple | list
:param dilation_y: The
y dimension of the dilation
.
:param dilation_y: The
dimension of the dilation on the y axis
.
:type dilation_y: int
:type dilation_y: int
:param bias_attr: The bias attribute. If the parameter is set to False or an object
:param bias_attr: The bias attribute. If the parameter is set to False or an object
whose type is not ParameterAttribute, no bias is defined. If the
whose type is not ParameterAttribute, no bias is defined. If the
parameter is set to True, the bias is initialized to zero.
parameter is set to 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: The number of input channels. If the parameter is not set or
automatically from previous output.
set to None, its actual value will be automatically set to
the channel number of the input.
:type num_channels: int
:type num_channels: int
:param param_attr: Convolution param attribute. None means default attribute
:param param_attr: The parameter attribute. See ParameterAttribute for
details.
:type param_attr: ParameterAttribute
:type param_attr: ParameterAttribute
:param shared_biases:
Is
biases will be shared between filters or not.
:param shared_biases:
Whether
biases will be shared between filters or not.
:type shared_biases: bool
:type shared_biases: bool
:param layer_attr: Layer Extra Attribute.
:param layer_attr: The extra layer attributes. See ExtraLayerAttribute for
details.
:type layer_attr: ExtraLayerAttribute
:type layer_attr: ExtraLayerAttribute
:param trans:
true if it is a convTransLayer, f
alse if it is a convLayer
:param trans:
True if it is a convTransLayer, F
alse if it is a convLayer
:type trans: bool
:type trans: bool
:param layer_type:
specify the layer_type, default is None. If trans=True,
:param layer_type:
Specify the layer type. If the dilation's dimension on one axis is
la
yer_type has to be "exconvt" or "cudnn_convt",
la
rger than 1, layer_type has to be "cudnn_conv" or "cudnn_convt".
otherwise layer_type has to be either "exconv" or
If trans=True, layer_type has to be "exconvt" or "cudnn_convt",
"cudnn_conv"
otherwise layer_type has to be either "exconv" or "cudnn_conv".
:type layer_type:
S
tring
:type layer_type:
bases
tring
:return: LayerOutput object.
:return: LayerOutput object.
:rtype: LayerOutput
:rtype: LayerOutput
"""
"""
...
@@ -2679,7 +2694,7 @@ def img_pool_layer(input,
...
@@ -2679,7 +2694,7 @@ def img_pool_layer(input,
"""
"""
Image pooling Layer.
Image pooling Layer.
The details of pooling layer, please refer ufldl's pooling_ .
The details of pooling layer, please refer
to
ufldl's pooling_ .
.. _pooling: http://ufldl.stanford.edu/tutorial/supervised/Pooling/
.. _pooling: http://ufldl.stanford.edu/tutorial/supervised/Pooling/
...
@@ -2711,32 +2726,37 @@ def img_pool_layer(input,
...
@@ -2711,32 +2726,37 @@ def img_pool_layer(input,
padding_y=2,
padding_y=2,
pool_type=MaxPooling())
pool_type=MaxPooling())
:param padding:
pooling padding width
.
:param padding:
The padding size on the x axis. 0 is the default padding size
.
:type padding: int
:type padding: int
:param padding_y:
pooling padding height. It's equal to padding by default.
:param padding_y:
The padding size on the y axis. If the parameter is not set
:type padding_y: int | None
or set to None, it will be set to 'padding' automatically.
:param name:
name of pooling layer
:param name:
The name of this layer. It is optional.
:type name: basestring
.
:type name: basestring
:param input: The input of this layer.
:param input: The input of this layer.
:type input: LayerOutput
:type input: LayerOutput
:param pool_size:
pooling window width
:param pool_size:
The pooling window length on the x axis.
: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: The pooling window length on the y axis. If the parameter is
:type pool_size_y: int | None
not set or set to None, its actual value will be automatically
:param num_channels: number of input channel.
set to pool_size.
:type pool_size_y: int
:param num_channels: The number of input channels. If the parameter is not set or
set to None, its actual value will be automatically set to
the channels number of the input.
:type num_channels: int
:type num_channels: int
:param pool_type: pooling type. MaxPooling or AvgPooling. Default is
:param pool_type: Pooling type. MaxPooling is the default pooling.
MaxPooling.
:type pool_type: BasePoolingType
:type pool_type: BasePoolingType
:param stride:
stride width of pooling
.
:param stride:
The stride on the x axis. 1 is the default value
.
:type stride: int
:type stride: int
:param stride_y: stride height of pooling. It is equal to stride by default.
:param stride_y: The stride on the y axis. If the parameter is not set or set to
:type stride_y: int | None
None, its actual value will be automatically set to 'stride'.
:param layer_attr: Extra Layer attribute.
:type stride_y: int
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
details.
:type layer_attr: ExtraLayerAttribute
:type layer_attr: ExtraLayerAttribute
:param ceil_mode: Wether to use
ceil mode to calculate output height and wi
th.
:param ceil_mode: Wether to use
the ceil function to calculate output height and wid
th.
Defalut is True. If set false, Otherwise use floor.
True is the default. If it is set to False, the floor function will
be used.
:type ceil_mode: bool
:type ceil_mode: bool
:return: LayerOutput object.
:return: LayerOutput object.
:rtype: LayerOutput
:rtype: LayerOutput
...
@@ -2842,24 +2862,32 @@ def img_pool3d_layer(input,
...
@@ -2842,24 +2862,32 @@ def img_pool3d_layer(input,
: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:
The name of this layer. It is optional.
:type name: basestring.
:type name: basestring.
:param input: The input of this layer.
:param input: The input of this layer.
:type input: LayerOutput
:type input: LayerOutput
:param pool_size: pooling window width
:param pool_size: The pooling window lengths along three axises. If the parameter
is set to one integer, the three lengths will be same.
:type pool_size: int | tuple | list
:type pool_size: int | tuple | list
:param num_channels: number of input channel.
:param num_channels: The number of input channels. If the parameter is not set or
set to None, its actual value will be automatically set to
the channels number of the input.
:type num_channels: int
:type num_channels: int
:param pool_type: pooling type. MaxPooling or AvgPooling. Default is
:param pool_type: Pooling type. MaxPooling is the default pooling.
MaxPooling.
:type pool_type: BasePoolingType
:type pool_type: BasePoolingType
:param stride: stride width of pooling.
:param stride: The strides of the pooling along three axises. If the parameter
is set to one integer, the three strides will be same. 1 is the
default value.
:type stride: int | tuple | list
:type stride: int | tuple | list
:param layer_attr: Extra Layer attribute.
:param padding: The sizes of padding along three axises. If the parameter is set to
one integer, they will be same. 0 is the default padding size.
:type padding: int | tuple | list
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
details.
:type layer_attr: ExtraLayerAttribute
:type layer_attr: ExtraLayerAttribute
:param ceil_mode: Wether to use
ceil mode to calculate output height and wi
th.
:param ceil_mode: Wether to use
the ceil function to calculate output height and wid
th.
Defalut is True. If set false, Otherwise use floor.
True is the default. If it is set to False, the floor function will
be used.
:type ceil_mode: bool
:type ceil_mode: bool
:return: LayerOutput object.
:return: LayerOutput object.
:rtype: LayerOutput
:rtype: LayerOutput
...
@@ -2938,9 +2966,11 @@ def spp_layer(input,
...
@@ -2938,9 +2966,11 @@ def spp_layer(input,
pyramid_height
=
None
,
pyramid_height
=
None
,
layer_attr
=
None
):
layer_attr
=
None
):
"""
"""
Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition.
A layer performs spatial pyramid pooling.
The details please refer to
`Kaiming He's paper <https://arxiv.org/abs/1406.4729>`_.
Reference:
Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition
https://arxiv.org/abs/1406.4729
The example usage is:
The example usage is:
...
@@ -2955,13 +2985,16 @@ def spp_layer(input,
...
@@ -2955,13 +2985,16 @@ def spp_layer(input,
:type name: basestring
:type name: basestring
:param input: The input of this layer.
:param input: The input of this layer.
:type input: LayerOutput
:type input: LayerOutput
:param num_channels: number of input channel.
:param num_channels: The number of input channels. If the parameter is not set or
set to None, its actual value will be automatically set to
the channels number of the input.
:type num_channels: int
:type num_channels: int
:param pool_type: Pooling type. MaxPooling
or AveragePooling. Default is MaxP
ooling.
:param pool_type: Pooling type. MaxPooling
is the default p
ooling.
:type scale: BasePoolingType
:type scale: BasePoolingType
:param pyramid_height:
pyramid height
.
:param pyramid_height:
The pyramid height of this pooling
.
:type pyramid_height: int
:type pyramid_height: int
:param layer_attr: Extra Layer Attribute.
:param layer_attr: The extra layer attribute. See ExtraLayerAttribute for
details.
:type layer_attr: ExtraLayerAttribute
:type layer_attr: ExtraLayerAttribute
:return: LayerOutput object.
:return: LayerOutput object.
:rtype: LayerOutput
:rtype: LayerOutput
...
@@ -4694,7 +4727,7 @@ def conv_projection(input,
...
@@ -4694,7 +4727,7 @@ def conv_projection(input,
will be same when filter_size_y is not set. If it is set
will be same when filter_size_y is not set. If it is set
to a list, the first element indicates the dimension on
to a list, the first element indicates the dimension on
the x axis, and the second is used to specify the dimension
the x axis, and the second is used to specify the dimension
on the y axis when filter_size is not provided.
on the y axis when filter_size
_y
is not provided.
:type filter_size: int | tuple | list
:type filter_size: int | tuple | list
:param filter_size_y: The dimension of the filter kernel on the y axis. If the parameter
:param filter_size_y: The dimension of the filter kernel on the y axis. If the parameter
is not set, it will be set automatically according to filter_size.
is not set, it will be set automatically according to filter_size.
...
@@ -7076,7 +7109,7 @@ def img_conv3d_layer(input,
...
@@ -7076,7 +7109,7 @@ def img_conv3d_layer(input,
:type layer_attr: ExtraLayerAttribute
:type layer_attr: ExtraLayerAttribute
:param trans: True if it is a convTransLayer, False if it is a convLayer
:param trans: True if it is a convTransLayer, False if it is a convLayer
:type trans: bool
:type trans: bool
:param layer_type: Specify the layer
_
type. If the parameter is set, it must be "deconv3d"
:param layer_type: Specify the layer
type. If the parameter is set, it must be "deconv3d"
when trans=True. If not set, it will be automatically set to "deconv3d"
when trans=True. If not set, it will be automatically set to "deconv3d"
when trans=True and "conv3d" when trans=False.
when trans=True and "conv3d" when trans=False.
:type layer_type: basestring
:type layer_type: basestring
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录