Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
d1a8498b
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d1a8498b
编写于
6月 17, 2018
作者:
Q
qiaolongfei
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/PaddlePaddle/Paddle
into update-api-reference-1
上级
a4ee0d0d
ea03a228
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
56 addition
and
53 deletion
+56
-53
paddle/fluid/operators/slice_op.cc
paddle/fluid/operators/slice_op.cc
+20
-17
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+36
-36
未找到文件。
paddle/fluid/operators/slice_op.cc
浏览文件 @
d1a8498b
...
@@ -95,8 +95,11 @@ of that dimension. If the value passed to start or end is larger than
...
@@ -95,8 +95,11 @@ of that dimension. If the value passed to start or end is larger than
the n (the number of elements in this dimension), it represents n.
the n (the number of elements in this dimension), it represents n.
For slicing to the end of a dimension with unknown size, it is recommended
For slicing to the end of a dimension with unknown size, it is recommended
to pass in INT_MAX. If axes are omitted, they are set to [0, ..., ndim-1].
to pass in INT_MAX. If axes are omitted, they are set to [0, ..., ndim-1].
Following examples will explain how slice works:
Example 1:
.. code-block:: text
Cast1:
Given:
Given:
data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
axes = [0, 1]
axes = [0, 1]
...
@@ -105,7 +108,7 @@ to pass in INT_MAX. If axes are omitted, they are set to [0, ..., ndim-1].
...
@@ -105,7 +108,7 @@ to pass in INT_MAX. If axes are omitted, they are set to [0, ..., ndim-1].
Then:
Then:
result = [ [5, 6, 7], ]
result = [ [5, 6, 7], ]
Example
2:
Cast
2:
Given:
Given:
data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
starts = [0, 1]
starts = [0, 1]
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
d1a8498b
...
@@ -1373,10 +1373,8 @@ def conv2d(input,
...
@@ -1373,10 +1373,8 @@ def conv2d(input,
Examples:
Examples:
.. code-block:: python
.. code-block:: python
data = fluid.layers.data(
data = fluid.layers.data(name='data', shape=[3, 32, 32], dtype='float32')
name='data', shape=[3, 32, 32], dtype='float32')
conv2d = fluid.layers.conv2d(input=data, num_filters=2, filter_size=3, act="relu")
conv2d = fluid.layers.conv2d(
input=data, num_filters=2, filter_size=3, act="relu")
"""
"""
num_channels
=
input
.
shape
[
1
]
num_channels
=
input
.
shape
[
1
]
...
@@ -1478,8 +1476,7 @@ def conv3d(input,
...
@@ -1478,8 +1476,7 @@ def conv3d(input,
* :math:`
\\
ast`: Convolution operation.
* :math:`
\\
ast`: Convolution operation.
* :math:`b`: Bias value, a 2-D tensor with shape [M, 1].
* :math:`b`: Bias value, a 2-D tensor with shape [M, 1].
* :math:`
\\
sigma`: Activation function.
* :math:`
\\
sigma`: Activation function.
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be different.
different.
Example:
Example:
...
@@ -1541,10 +1538,8 @@ def conv3d(input,
...
@@ -1541,10 +1538,8 @@ def conv3d(input,
Examples:
Examples:
.. code-block:: python
.. code-block:: python
data = fluid.layers.data(
data = fluid.layers.data(name='data', shape=[3, 12, 32, 32], dtype='float32')
name='data', shape=[3, 12, 32, 32], dtype='float32')
conv3d = fluid.layers.conv3d(input=data, num_filters=2, filter_size=3, act="relu")
conv2d = fluid.layers.conv3d(
input=data, num_filters=2, filter_size=3, act="relu")
"""
"""
l_type
=
'conv3d'
l_type
=
'conv3d'
...
@@ -2182,32 +2177,36 @@ def conv2d_transpose(input,
...
@@ -2182,32 +2177,36 @@ def conv2d_transpose(input,
represent height and width, respectively. The details of convolution transpose
represent height and width, respectively. The details of convolution transpose
layer, please refer to the following explanation and references
layer, please refer to the following explanation and references
`therein <http://www.matthewzeiler.com/wp-content/uploads/2017/07/cvpr2010.pdf>`_.
`therein <http://www.matthewzeiler.com/wp-content/uploads/2017/07/cvpr2010.pdf>`_.
If bias attribution and activation type are provided, bias is added to
the output of the convolution, and the corresponding activation function
is applied to the final result.
For each input :math:`X`, the equation is:
For each input :math:`X`, the equation is:
.. math::
.. math::
Out =
W
\\
ast X
Out =
\sigma (W
\\
ast X + b)
In the above equation
:
Where
:
* :math:`X`: Input value, a tensor with NCHW format.
* :math:`X`: Input value, a tensor with NCHW format.
* :math:`W`: Filter value, a tensor with MCHW format.
* :math:`W`: Filter value, a tensor with MCHW format.
* :math:`
\\
ast` : Convolution transpose operation.
* :math:`
\\
ast`: Convolution operation.
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be
* :math:`b`: Bias value, a 2-D tensor with shape [M, 1].
different.
* :math:`
\\
sigma`: Activation function.
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be different.
Example:
Example:
- Input:
- Input:
Input shape:
$(N, C_{in}, H_{in}, W_{in})$
Input shape:
:math:`(N, C_{in}, H_{in}, W_{in})`
Filter shape:
$(C_{in}, C_{out}, H_f, W_f)$
Filter shape:
:math:`(C_{in}, C_{out}, H_f, W_f)`
- Output:
- Output:
Output shape:
$(N, C_{out}, H_{out}, W_{out})$
Output shape:
:math:`(N, C_{out}, H_{out}, W_{out})`
Where
Where
...
@@ -2261,10 +2260,8 @@ def conv2d_transpose(input,
...
@@ -2261,10 +2260,8 @@ def conv2d_transpose(input,
Examples:
Examples:
.. code-block:: python
.. code-block:: python
data = fluid.layers.data(
data = fluid.layers.data(name='data', shape=[3, 32, 32], dtype='float32')
name='data', shape=[3, 32, 32], dtype='float32')
conv2d_transpose = fluid.layers.conv2d_transpose(input=data, num_filters=2, filter_size=3)
conv2d_transpose = fluid.layers.conv2d_transpose(
input=data, num_filters=2, filter_size=3)
"""
"""
helper
=
LayerHelper
(
"conv2d_transpose"
,
**
locals
())
helper
=
LayerHelper
(
"conv2d_transpose"
,
**
locals
())
if
not
isinstance
(
input
,
Variable
):
if
not
isinstance
(
input
,
Variable
):
...
@@ -2344,32 +2341,36 @@ def conv3d_transpose(input,
...
@@ -2344,32 +2341,36 @@ def conv3d_transpose(input,
two elements. These two elements represent height and width, respectively.
two elements. These two elements represent height and width, respectively.
The details of convolution transpose layer, please refer to the following
The details of convolution transpose layer, please refer to the following
explanation and references `therein <http://www.matthewzeiler.com/wp-content/uploads/2017/07/cvpr2010.pdf>`_.
explanation and references `therein <http://www.matthewzeiler.com/wp-content/uploads/2017/07/cvpr2010.pdf>`_.
If bias attribution and activation type are provided, bias is added to
the output of the convolution, and the corresponding activation function
is applied to the final result.
For each input :math:`X`, the equation is:
For each input :math:`X`, the equation is:
.. math::
.. math::
Out =
W
\\
ast X
Out =
\sigma (W
\\
ast X + b)
In the above equation:
In the above equation:
* :math:`X`: Input value, a tensor with NCDHW format.
* :math:`X`: Input value, a tensor with NCDHW format.
* :math:`W`: Filter value, a tensor with MCDHW format.
* :math:`W`: Filter value, a tensor with MCDHW format.
* :math:`
\\
ast` : Convolution transpose operation.
* :math:`
\\
ast`: Convolution operation.
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be
* :math:`b`: Bias value, a 2-D tensor with shape [M, 1].
different.
* :math:`
\\
sigma`: Activation function.
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be different.
Example:
Example:
- Input:
- Input:
Input shape:
$(N, C_{in}, D_{in}, H_{in}, W_{in})$
Input shape:
:math:`(N, C_{in}, D_{in}, H_{in}, W_{in})`
Filter shape:
$(C_{in}, C_{out}, D_f, H_f, W_f)$
Filter shape:
:math:`(C_{in}, C_{out}, D_f, H_f, W_f)`
- Output:
- Output:
Output shape:
$(N, C_{out}, D_{out}, H_{out}, W_{out})$
Output shape:
:math:`(N, C_{out}, D_{out}, H_{out}, W_{out})`
Where
Where
...
@@ -2424,10 +2425,8 @@ def conv3d_transpose(input,
...
@@ -2424,10 +2425,8 @@ def conv3d_transpose(input,
Examples:
Examples:
.. code-block:: python
.. code-block:: python
data = fluid.layers.data(
data = fluid.layers.data(name='data', shape=[3, 12, 32, 32], dtype='float32')
name='data', shape=[3, 12, 32, 32], dtype='float32')
conv3d_transpose = fluid.layers.conv3d_transpose(input=data, num_filters=2, filter_size=3)
conv2d_transpose = fluid.layers.conv3d_transpose(
input=data, num_filters=2, filter_size=3)
"""
"""
l_type
=
"conv3d_transpose"
l_type
=
"conv3d_transpose"
helper
=
LayerHelper
(
l_type
,
**
locals
())
helper
=
LayerHelper
(
l_type
,
**
locals
())
...
@@ -4779,7 +4778,7 @@ def mean_iou(input, label, num_classes):
...
@@ -4779,7 +4778,7 @@ def mean_iou(input, label, num_classes):
.. math::
.. math::
IOU =
true_positive / (true_positive + false_positive + false_negative).
IOU =
\\
frac{true\_positiv}{(true\_positive + false\_positive + false\_negative)}.
The predictions are accumulated in a confusion matrix and mean-IOU
The predictions are accumulated in a confusion matrix and mean-IOU
is then calculated from it.
is then calculated from it.
...
@@ -4789,6 +4788,7 @@ def mean_iou(input, label, num_classes):
...
@@ -4789,6 +4788,7 @@ def mean_iou(input, label, num_classes):
input (Variable): A Tensor of prediction results for semantic labels with type int32 or int64.
input (Variable): A Tensor of prediction results for semantic labels with type int32 or int64.
label (Variable): A Tensor of ground truth labels with type int32 or int64.
label (Variable): A Tensor of ground truth labels with type int32 or int64.
Its shape should be the same as input.
Its shape should be the same as input.
num_classes (int): The possible number of labels.
Returns:
Returns:
mean_iou (Variable): A Tensor representing the mean intersection-over-union with shape [1].
mean_iou (Variable): A Tensor representing the mean intersection-over-union with shape [1].
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录