Skip to content

Commit 7b82353

Browse files
committed
fix conv3d/conv3d_trans/slice/mean_iou doc
1 parent 0329ee7 commit 7b82353

File tree

2 files changed

+56
-53
lines changed

2 files changed

+56
-53
lines changed

paddle/fluid/operators/slice_op.cc

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,26 @@ of that dimension. If the value passed to start or end is larger than
9595
the n (the number of elements in this dimension), it represents n.
9696
For slicing to the end of a dimension with unknown size, it is recommended
9797
to pass in INT_MAX. If axes are omitted, they are set to [0, ..., ndim-1].
98-
99-
Example 1:
100-
Given:
101-
data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
102-
axes = [0, 1]
103-
starts = [1, 0]
104-
ends = [2, 3]
105-
Then:
106-
result = [ [5, 6, 7], ]
107-
108-
Example 2:
109-
Given:
110-
data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
111-
starts = [0, 1]
112-
ends = [-1, 1000]
113-
Then:
114-
result = [ [2, 3, 4], ]
98+
Following examples will explain how slice works:
99+
100+
.. code-block:: text
101+
102+
Cast1:
103+
Given:
104+
data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
105+
axes = [0, 1]
106+
starts = [1, 0]
107+
ends = [2, 3]
108+
Then:
109+
result = [ [5, 6, 7], ]
110+
111+
Cast2:
112+
Given:
113+
data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
114+
starts = [0, 1]
115+
ends = [-1, 1000]
116+
Then:
117+
result = [ [2, 3, 4], ]
115118
)DOC");
116119
}
117120
};

python/paddle/fluid/layers/nn.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,10 +1326,8 @@ def conv2d(input,
13261326
Examples:
13271327
.. code-block:: python
13281328
1329-
data = fluid.layers.data(
1330-
name='data', shape=[3, 32, 32], dtype='float32')
1331-
conv2d = fluid.layers.conv2d(
1332-
input=data, num_filters=2, filter_size=3, act="relu")
1329+
data = fluid.layers.data(name='data', shape=[3, 32, 32], dtype='float32')
1330+
conv2d = fluid.layers.conv2d(input=data, num_filters=2, filter_size=3, act="relu")
13331331
"""
13341332

13351333
num_channels = input.shape[1]
@@ -1431,8 +1429,7 @@ def conv3d(input,
14311429
* :math:`\\ast`: Convolution operation.
14321430
* :math:`b`: Bias value, a 2-D tensor with shape [M, 1].
14331431
* :math:`\\sigma`: Activation function.
1434-
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be
1435-
different.
1432+
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be different.
14361433
14371434
Example:
14381435
@@ -1494,10 +1491,8 @@ def conv3d(input,
14941491
Examples:
14951492
.. code-block:: python
14961493
1497-
data = fluid.layers.data(
1498-
name='data', shape=[3, 12, 32, 32], dtype='float32')
1499-
conv2d = fluid.layers.conv3d(
1500-
input=data, num_filters=2, filter_size=3, act="relu")
1494+
data = fluid.layers.data(name='data', shape=[3, 12, 32, 32], dtype='float32')
1495+
conv3d = fluid.layers.conv3d(input=data, num_filters=2, filter_size=3, act="relu")
15011496
"""
15021497

15031498
l_type = 'conv3d'
@@ -2105,32 +2100,36 @@ def conv2d_transpose(input,
21052100
represent height and width, respectively. The details of convolution transpose
21062101
layer, please refer to the following explanation and references
21072102
`therein <http://www.matthewzeiler.com/wp-content/uploads/2017/07/cvpr2010.pdf>`_.
2103+
If bias attribution and activation type are provided, bias is added to
2104+
the output of the convolution, and the corresponding activation function
2105+
is applied to the final result.
21082106
21092107
For each input :math:`X`, the equation is:
21102108
21112109
.. math::
21122110
2113-
Out = W \\ast X
2111+
Out = \sigma (W \\ast X + b)
21142112
2115-
In the above equation:
2113+
Where:
21162114
21172115
* :math:`X`: Input value, a tensor with NCHW format.
21182116
* :math:`W`: Filter value, a tensor with MCHW format.
2119-
* :math:`\\ast` : Convolution transpose operation.
2120-
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be
2121-
different.
2117+
* :math:`\\ast`: Convolution operation.
2118+
* :math:`b`: Bias value, a 2-D tensor with shape [M, 1].
2119+
* :math:`\\sigma`: Activation function.
2120+
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be different.
21222121
21232122
Example:
21242123
21252124
- Input:
21262125
2127-
Input shape: $(N, C_{in}, H_{in}, W_{in})$
2126+
Input shape: :math:`(N, C_{in}, H_{in}, W_{in})`
21282127
2129-
Filter shape: $(C_{in}, C_{out}, H_f, W_f)$
2128+
Filter shape: :math:`(C_{in}, C_{out}, H_f, W_f)`
21302129
21312130
- Output:
21322131
2133-
Output shape: $(N, C_{out}, H_{out}, W_{out})$
2132+
Output shape: :math:`(N, C_{out}, H_{out}, W_{out})`
21342133
21352134
Where
21362135
@@ -2184,10 +2183,8 @@ def conv2d_transpose(input,
21842183
Examples:
21852184
.. code-block:: python
21862185
2187-
data = fluid.layers.data(
2188-
name='data', shape=[3, 32, 32], dtype='float32')
2189-
conv2d_transpose = fluid.layers.conv2d_transpose(
2190-
input=data, num_filters=2, filter_size=3)
2186+
data = fluid.layers.data(name='data', shape=[3, 32, 32], dtype='float32')
2187+
conv2d_transpose = fluid.layers.conv2d_transpose(input=data, num_filters=2, filter_size=3)
21912188
"""
21922189
helper = LayerHelper("conv2d_transpose", **locals())
21932190
if not isinstance(input, Variable):
@@ -2267,32 +2264,36 @@ def conv3d_transpose(input,
22672264
two elements. These two elements represent height and width, respectively.
22682265
The details of convolution transpose layer, please refer to the following
22692266
explanation and references `therein <http://www.matthewzeiler.com/wp-content/uploads/2017/07/cvpr2010.pdf>`_.
2267+
If bias attribution and activation type are provided, bias is added to
2268+
the output of the convolution, and the corresponding activation function
2269+
is applied to the final result.
22702270
22712271
For each input :math:`X`, the equation is:
22722272
22732273
.. math::
22742274
2275-
Out = W \\ast X
2275+
Out = \sigma (W \\ast X + b)
22762276
22772277
In the above equation:
22782278
22792279
* :math:`X`: Input value, a tensor with NCDHW format.
22802280
* :math:`W`: Filter value, a tensor with MCDHW format.
2281-
* :math:`\\ast` : Convolution transpose operation.
2282-
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be
2283-
different.
2281+
* :math:`\\ast`: Convolution operation.
2282+
* :math:`b`: Bias value, a 2-D tensor with shape [M, 1].
2283+
* :math:`\\sigma`: Activation function.
2284+
* :math:`Out`: Output value, the shape of :math:`Out` and :math:`X` may be different.
22842285
22852286
Example:
22862287
22872288
- Input:
22882289
2289-
Input shape: $(N, C_{in}, D_{in}, H_{in}, W_{in})$
2290+
Input shape: :math:`(N, C_{in}, D_{in}, H_{in}, W_{in})`
22902291
2291-
Filter shape: $(C_{in}, C_{out}, D_f, H_f, W_f)$
2292+
Filter shape: :math:`(C_{in}, C_{out}, D_f, H_f, W_f)`
22922293
22932294
- Output:
22942295
2295-
Output shape: $(N, C_{out}, D_{out}, H_{out}, W_{out})$
2296+
Output shape: :math:`(N, C_{out}, D_{out}, H_{out}, W_{out})`
22962297
22972298
Where
22982299
@@ -2347,10 +2348,8 @@ def conv3d_transpose(input,
23472348
Examples:
23482349
.. code-block:: python
23492350
2350-
data = fluid.layers.data(
2351-
name='data', shape=[3, 12, 32, 32], dtype='float32')
2352-
conv2d_transpose = fluid.layers.conv3d_transpose(
2353-
input=data, num_filters=2, filter_size=3)
2351+
data = fluid.layers.data(name='data', shape=[3, 12, 32, 32], dtype='float32')
2352+
conv3d_transpose = fluid.layers.conv3d_transpose(input=data, num_filters=2, filter_size=3)
23542353
"""
23552354
l_type = "conv3d_transpose"
23562355
helper = LayerHelper(l_type, **locals())
@@ -4680,17 +4679,18 @@ def mean_iou(input, label, num_classes):
46804679
IOU is defined as follows:
46814680
46824681
.. math::
4683-
4684-
IOU = true_positive / (true_positive + false_positive + false_negative).
4682+
4683+
IOU = \\frac{true\_positiv}{(true\_positive + false\_positive + false\_negative)}.
46854684
46864685
The predictions are accumulated in a confusion matrix and mean-IOU
46874686
is then calculated from it.
46884687
46894688
46904689
Args:
46914690
input (Variable): A Tensor of prediction results for semantic labels with type int32 or int64.
4692-
label (Variable): A Tensor of ground truth labels with type int32 or int64.
4691+
label (Variable): A Tensor of ground truth labels with type int32 or int64.
46934692
Its shape should be the same as input.
4693+
num_classes (int): The possible number of labels.
46944694
46954695
Returns:
46964696
mean_iou (Variable): A Tensor representing the mean intersection-over-union with shape [1].

0 commit comments

Comments
 (0)