From 649ecd4f96ef8af04f401d6bb09f1e0bbd2ae557 Mon Sep 17 00:00:00 2001 From: ruri Date: Tue, 24 Sep 2019 11:15:48 +0800 Subject: [PATCH] refine cn documents, test=document_preview (#1284) --- .../api_cn/layers_cn/density_prior_box_cn.rst | 66 ++++++------------- .../api_cn/layers_cn/edit_distance_cn.rst | 21 +++--- .../api_cn/layers_cn/image_resize_cn.rst | 28 ++++---- .../layers_cn/image_resize_short_cn.rst | 4 +- .../api_cn/layers_cn/l2_normalize_cn.rst | 21 +++--- .../api_cn/layers_cn/pixel_shuffle_cn.rst | 8 +-- doc/fluid/api_cn/layers_cn/prior_box_cn.rst | 39 +++++------ .../api_cn/layers_cn/resize_bilinear_cn.rst | 18 ++--- .../api_cn/layers_cn/resize_nearest_cn.rst | 21 +++--- doc/fluid/api_cn/layers_cn/sampling_id_cn.rst | 16 ++--- .../api_cn/layers_cn/shuffle_channel_cn.rst | 10 ++- .../api_cn/layers_cn/square_error_cost_cn.rst | 19 ++---- 12 files changed, 115 insertions(+), 156 deletions(-) diff --git a/doc/fluid/api_cn/layers_cn/density_prior_box_cn.rst b/doc/fluid/api_cn/layers_cn/density_prior_box_cn.rst index d0d2b5d5d..0b122b32e 100644 --- a/doc/fluid/api_cn/layers_cn/density_prior_box_cn.rst +++ b/doc/fluid/api_cn/layers_cn/density_prior_box_cn.rst @@ -6,13 +6,7 @@ density_prior_box .. py:function:: paddle.fluid.layers.density_prior_box(input, image, densities=None, fixed_sizes=None, fixed_ratios=None, variance=[0.1, 0.1, 0.2, 0.2], clip=False, steps=[0.0, 0.0], offset=0.5, flatten_to_2d=False, name=None) -**Density Prior Box Operator** - -为SSD算法(Single Shot MultiBox Detector)生成density prior box。 -每个 ``input`` 的位置产生N个prior box,其中,N通过 ``densities`` , ``fixed_sizes`` 和 ``fixed_ratios`` -的量来决定。在每个input位置附近的box center格点,通过此op生成。格点坐标由 ``densities`` 决定, -density prior box的量由 ``fixed_sizes`` 和 ``fixed_ratios`` 决定。显然地,``fixed_sizes`` -和 ``densities`` 相等。对于 ``densities`` 中的densities_i: +该OP为SSD算法(Single Shot MultiBox Detector)生成density prior box,在每个 ``input`` 的位置产生N个候选框,其中,N由 ``densities`` , ``fixed_sizes`` 和 ``fixed_ratios`` 来计算。生成的每个输入位置附近的候选框中心(网格点)由 ``densities`` 和 ``density prior box`` 的数量计算,其中 ``density prior box`` 的数量由 ``fixed_sizes`` 和 ``fixed_ratios`` 决定。``fixed_sizes`` 和 ``densities`` 的大小一致。 .. math:: @@ -20,40 +14,33 @@ density prior box的量由 ``fixed_sizes`` 和 ``fixed_ratios`` 决定。显然 参数: - - **input** (Variable) - 输入变量,格式为NCHW - - **image** (Variable) - PriorBoxOp的输入图像数据,格式为NCHW - - **densities** (list|tuple|None) - 被生成的density prior boxes的densities,此属性应该是一个整数列表或数组。默认值为None - - **fixed_sizes** (list|tuple|None) - 被生成的density prior boxes的固定大小,此属性应该为和 :attr:`densities` 有同样长度的列表或数组。默认值为None - - **fixed_ratios** (list|tuple|None) - 被生成的density prior boxes的固定长度,如果该属性未被设置,同时 :attr:`densities` 和 :attr:`fix_sizes` 被设置,则 :attr:`aspect_ratios` 被用于生成 density prior boxes + - **input** (Variable) - 形状为NCHW的4-D Tensor,数据类型为float32或float64。 + - **image** (Variable) - 输入图像,形状为NCHW的4-D Tensor,数据类型为float32或float64。 + - **densities** (list|tuple|None) - 生成的density prior boxes的densities,此属性应该是一个整数列表或数组。默认值为None。 + - **fixed_sizes** (list|tuple|None) - 生成的density prior boxes的大小,此属性应该为和 :attr:`densities` 有同样长度的列表或数组。默认值为None。 + - **fixed_ratios** (list|tuple|None) - 生成的density prior boxes的比值,如果该属性未被设置,同时 :attr:`densities` 和 :attr:`fix_sizes` 被设置,则 :attr:`aspect_ratios` 被用于生成 density prior boxes - **variance** (list|tuple) - 将被用于density prior boxes编码的方差,默认值为:[0.1, 0.1, 0.2, 0.2] - - **clip(bool)** - 是否clip超出范围的box。默认值:False - - **step** (list|tuple) - Prior boxes在宽度和高度的步长,如果step[0] == 0.0/step[1] == 0.0, input的the density prior boxes的高度/宽度的步长将被自动计算。默认值:Default: [0., 0.] - - **offset** (float) - Prior boxes中心补偿值,默认为:0.5 - - **flatten_to_2d** (bool) - 是否将output prior boxes和方差 ``flatten`` 至2维形状,第二个dim为4。默认值:False - - **name(str)** - density prior box op的名字,默认值: None - -返回: - tuple: 有两个变量的数组 (boxes, variances) - - boxes: PriorBox的输出density prior boxes - - 当flatten_to_2d为False时,形式为[H, W, num_priors, 4] - - 当flatten_to_2d为True时,形式为[H * W * num_priors, 4] + - **clip** (bool) - 是否裁剪超出范围的box。默认值:False + - **step** (list|tuple) - Prior boxes在宽度和高度的步长,如果step[0]等于0.0或step[1]等于0.0, input的the density prior boxes的高度/宽度的步长将被自动计算。默认值:Default: [0., 0.] + - **offset** (float) - Prior boxes中心偏移值,默认为:0.5 + - **flatten_to_2d** (bool) - 是否将output prior boxes和方差 ``flatten`` 至2-D,其中第二个dim为4。默认值:False + - **name** (str|None) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。默认值为None。 - H是输入的高度,W是输入的宽度 - num_priors是输入中每个位置的总box count +返回:含有两个变量的元组,包括: + 候选框: - variances: PriorBox的expanded variance + 当flatten_to_2d为False时,形状为[H, W, num_priors, 4]的4-D Tensor。 + 当flatten_to_2d为True时,形式为[H * W * num_priors, 4]的 2-D Tensor。 + 其中,H是输入的高度,W是输入的宽度,num_priors是输入中每个位置的候选框数。 - 当flatten_to_2d为False时,形式为[H, W, num_priors, 4] + 候选框的方差: - 当flatten_to_2d为True时,形式为[H * W * num_priors, 4] + 当flatten_to_2d为False时,形状为[H, W, num_priors, 4]的4-D Tensor。 + 当flatten_to_2d为True时,形式为[H * W * num_priors, 4]的2-D Tensor。 + 其中,H是输入的高度,W是输入的宽度,num_priors是输入中每个位置的候选框数。 - H是输入的高度,W是输入的宽度 - - num_priors是输入中每个位置的总box count +返回类型:元组 **代码示例** @@ -70,14 +57,3 @@ density prior box的量由 ``fixed_sizes`` 和 ``fixed_ratios`` 决定。显然 fixed_ratios=[1.], clip=True, flatten_to_2d=True) - - - - - - - - - - - diff --git a/doc/fluid/api_cn/layers_cn/edit_distance_cn.rst b/doc/fluid/api_cn/layers_cn/edit_distance_cn.rst index 37b4cd7df..0cf28491a 100644 --- a/doc/fluid/api_cn/layers_cn/edit_distance_cn.rst +++ b/doc/fluid/api_cn/layers_cn/edit_distance_cn.rst @@ -6,9 +6,7 @@ edit_distance .. py:function:: paddle.fluid.layers.edit_distance(input,label,normalized=True,ignored_tokens=None, input_length=None, label_length=None) -编辑距离算子 - -计算一批给定字符串及其参照字符串间的编辑距离。编辑距离也称Levenshtein距离,通过计算从一个字符串变成另一个字符串所需的最少操作步骤来衡量两个字符串的相异度。这里的操作包括插入、删除和替换。 +该OP计算一批给定字符串及其参照字符串间的编辑距离。编辑距离也称Levenshtein距离,通过计算从一个字符串变成另一个字符串所需的最少操作步骤来衡量两个字符串的相异度。这里的操作包括插入、删除和替换。 比如给定假设字符串A=“kitten”和参照字符串B=“sitting”,从A变换成B编辑距离为3,至少需要两次替换和一次插入: @@ -19,14 +17,15 @@ edit_distance 输出包含批尺寸大小的结果,代表一对字符串中每个字符串的编辑距离。如果Attr(normalized)为真,编辑距离则处以参照字符串的长度。 参数: - - **input** (Variable)-假设字符串的索引,为两列并且类型为int64 - - **label** (Variable)-参照字符串的索引,为两列并且类型为int64 - - **normalized** (bool,默认为True)-表示是否用参照字符串的长度进行归一化 - - **ignored_tokens** (list,默认为None)-计算编辑距离前需要移除的token - - **name** (str)-该层名称,可选 + - **input** (Variable) - 假设字符串的索引,rank为2的Tensor或LoDTensor,数据类型为int64。 + - **label** (Variable) - 参照字符串的索引,rank为2的Tensor或LoDTensor,数据类型为int64。 + - **normalized** (bool)-表示是否用参照字符串的长度进行归一化,默认值为True。 + - **ignored_tokens** (list)-计算编辑距离前需要移除的token,默认值为None。 + - **name** (None|str) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_name` ,默认值为None。 + +返回:包含有形为[batch_size,1]的编辑距离和形为[ ]的序列数元组。 -返回:形为[batch_size,1]的编辑距离。 -sequence_num(Variable):形为[ ]的序列数 +返回类型:元组 **代码示例** @@ -47,4 +46,4 @@ sequence_num(Variable):形为[ ]的序列数 x_len = fluid.layers.data(name='x_len', shape=[], dtype='int64') y_len = fluid.layers.data(name='y_len', shape=[], dtype='int64') distance_pad, seq_num_pad = fluid.layers.edit_distance( - input=x_pad, label=y_pad, input_length=x_len, label_length=y_len) \ No newline at end of file + input=x_pad, label=y_pad, input_length=x_len, label_length=y_len) diff --git a/doc/fluid/api_cn/layers_cn/image_resize_cn.rst b/doc/fluid/api_cn/layers_cn/image_resize_cn.rst index b040350c9..e9367ed49 100644 --- a/doc/fluid/api_cn/layers_cn/image_resize_cn.rst +++ b/doc/fluid/api_cn/layers_cn/image_resize_cn.rst @@ -7,11 +7,11 @@ image_resize **注意:** 参数 ``actual_shape`` 将被弃用,请使用 ``out_shape`` 替代。 -调整一个batch中图片的大小。 +该OP用于调整一个batch中图片的大小。 -输入张量的shape为(num_batches, channels, in_h, in_w)或者(num_batches, channels, in_d, in_h, in_w),并且调整大小只适用于最后两、三个维度(深度,高度和宽度)。 +输入张量的shape为(num_batches, channels, in_h, in_w)或者(num_batches, channels, in_d, in_h, in_w),并且调整大小只适用于最后两或三个维度(深度,高度和宽度)。 -支持重新取样方法: +支持的插值方法: BILINEAR:双线性插值 @@ -107,25 +107,25 @@ Align_corners和align_mode是可选参数,插值的计算方法可以由它们 有关最近邻插值的详细信息,请参阅维基百科: -https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation。 +https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation 有关双线性插值的详细信息,请参阅维基百科: -https://en.wikipedia.org/wiki/Bilinear_interpolation。 +https://en.wikipedia.org/wiki/Bilinear_interpolation 有关三线插值的详细信息,请参阅维基百科: -https://en.wikipedia.org/wiki/Trilinear_interpolation。 +https://en.wikipedia.org/wiki/Trilinear_interpolation 参数: - - **input** (Variable) - 图片调整层的输入张量,这是一个shape为(num_batches, channels, in_h, in_w)的4-D张量或者shape为(num_batches, channels, in_d, in_h, in_w)的5-D张量。 - - **out_shape** (list|tuple|Variable|None) - 图片调整层的输出,输入为4D张量时shape为(out_h, out_w)。输入为5D张量时shape为(out_d, out_h, out_w),默认值:None。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者shape为[1]的变量。如果 :code:`out_shape` 是变量,则其维度大小为1。 - - **scale** (float|Variable|None)-输入的高度或宽度的乘数因子 。 out_shape和scale至少要设置一个。out_shape的优先级高于scale。默认值:None - - **name** (str|None) - 该层的名称(可选)。如果设置为None,该层将被自动命名 - - **resample** (str) - 重采样方法。支持“双线性”,“三线性”,“临近插值”,。默认值:双线性插值 + - **input** (Variable) - 形状为(num_batches, channels, in_h, in_w)的4-D Tensor或者形状为(num_batches, channels, in_d, in_h, in_w)的5-D Tensor。 + - **out_shape** (list|tuple|Variable|None) - 输出Tensor,输入为4D张量时,形状为为(out_h, out_w)的2-D Tensor。输入为5-D Tensor时,形状为(out_d, out_h, out_w)的3-D Tensor。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者形状为[1]的变量。如果 :code:`out_shape` 是变量,则其维度大小为1。默认值为None。 + - **scale** (float|Variable|None)-输入的高度或宽度的乘数因子 。 out_shape和scale至少要设置一个。out_shape的优先级高于scale。默认值为None。 + - **name** (str|None) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。默认值为None。 + - **resample** (str) - 插值方法。支持“双线性”,“三线性”,“临近插值”。默认值为双线性插值。 - **actual_shape** (Variable) - 可选输入,用于动态指定输出形状。如果指定actual_shape,图像将根据给定的形状调整大小,而不是根据指定形状的 :code:`out_shape` 和 :code:`scale` 进行调整。也就是说, :code:`actual_shape` 具有最高的优先级。如果希望动态指定输出形状,建议使用 :code:`out_shape` ,因为 :code:`actual_shape` 未来将被弃用。在使用actual_shape指定输出形状时,还需要设置out_shape和scale之一,否则在图形构建阶段会出现错误。默认值:None - - **align_corners** (bool)- 一个可选的bool型参数,如果为True,则将输入和输出张量的4个角落像素的中心对齐,并保留角点像素的值。 默认值:True - - **align_mode** (int)- 双线性插值的可选项。 可以是 '0' 代表src_idx = scale *(dst_indx + 0.5)-0.5;可以为'1' ,代表src_idx = scale * dst_index。 + - **align_corners** (bool)- 一个可选的bool型参数,如果为True,则将输入和输出张量的4个角落像素的中心对齐,并保留角点像素的值。 默认值为True + - **align_mode** (int)- 双线性插值的可选项。 可以是 '0' 代表src_idx = scale *(dst_indx + 0.5)-0.5;如果为'1' ,代表src_idx = scale * dst_index。 -返回: 4维tensor,shape为 (num_batches, channls, out_h, out_w).或者5维tensor,shape为 (num_batches, channls, out_d, out_h, out_w). +返回: 4-D Tensor,形状为 [num_batches, channls, out_h, out_w]。或者5-D Tensor,形状为 [num_batches, channls, out_d, out_h, out_w]。 返回类型: 变量(variable) diff --git a/doc/fluid/api_cn/layers_cn/image_resize_short_cn.rst b/doc/fluid/api_cn/layers_cn/image_resize_short_cn.rst index 694333021..438261d30 100644 --- a/doc/fluid/api_cn/layers_cn/image_resize_short_cn.rst +++ b/doc/fluid/api_cn/layers_cn/image_resize_short_cn.rst @@ -5,10 +5,10 @@ image_resize_short .. py:function:: paddle.fluid.layers.image_resize_short(input, out_short_len, resample='BILINEAR') -调整一批图片的大小。输入图像的短边将被调整为给定的out_short_len 。输入图像的长边按比例调整大小,最终图像的长宽比保持不变。 +该OP用于调整一批图片的大小。输入图像的短边将被调整为给定的out_short_len 。输入图像的长边按比例调整大小,最终图像的长宽比保持不变。 参数: - - **input** (Variable) - 图像调整图层的输入张量,这是一个4维的形状张量(num_batch, channels, in_h, in_w)。 + - **input** (Variable) - 图像调整图层的输入张量,这是一个维度为[num_batch, channels, in_h, in_w]的4-D Tensor。 - **out_short_len** (int) - 输出图像的短边长度。 - **resample** (str) - resample方法,默认为双线性插值。 diff --git a/doc/fluid/api_cn/layers_cn/l2_normalize_cn.rst b/doc/fluid/api_cn/layers_cn/l2_normalize_cn.rst index a5b1636fc..f87458a79 100644 --- a/doc/fluid/api_cn/layers_cn/l2_normalize_cn.rst +++ b/doc/fluid/api_cn/layers_cn/l2_normalize_cn.rst @@ -5,25 +5,24 @@ l2_normalize .. py:function:: paddle.fluid.layers.l2_normalize(x,axis,epsilon=1e-12,name=None) -L2正则(L2 normalize Layer) - -该层用欧几里得距离之和对维轴的x归一化。对于1-D张量(系数矩阵的维度固定为0),该层计算公式如下: +该OP计算欧几里得距离之和对x进行归一化。对于1-D张量(系数矩阵的维度固定为0) +计算公式如下: .. math:: - y=\frac{x}{\sqrt{\sum x^{2}+epsion}} + y=\frac{x}{\sqrt{\sum x^{2}+epsilon}} -对于x多维的情况,该函数分别对维度轴上的每个1-D切片单独归一化 +对于输入为多维Tensor的情况,该OP分别对维度轴上的每个1-D切片单独归一化 参数: - - **x** (Variable|list)- l2正则层(l2_normalize layer)的输入 - - **axis** (int)-运用归一化的轴。如果轴小于0,归一化的维是rank(X)+axis。-1是最后维 - - **epsilon** (float)-epsilon用于避免分母为0,默认值为1e-12 - - **name** (str|None)-该层名称(可选)。如果设为空,则自动为该层命名 + - **x** (Variable) - 维度为 :math:`[N_1, N_2, ..., N_k, D]` 的多维Tensor,其中最后一维D是类别数目。数据类型为float32或float64。 + - **axis** (int) - 归一化的轴。如果轴小于0,归一化的维是rank(X)+axis。其中,-1用来表示最后一维。 + - **epsilon** (float) - epsilon,用于避免除0,默认值为1e-12。 + - **name** (str|None) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。默认值为None。 - 返回:输出张量,同x的维度一致 + 返回:与输入x的维度一致的Tensor - 返回类型:变量 + 返回类型:Variable **代码示例**: diff --git a/doc/fluid/api_cn/layers_cn/pixel_shuffle_cn.rst b/doc/fluid/api_cn/layers_cn/pixel_shuffle_cn.rst index 3c744b20c..bd6b1cd77 100644 --- a/doc/fluid/api_cn/layers_cn/pixel_shuffle_cn.rst +++ b/doc/fluid/api_cn/layers_cn/pixel_shuffle_cn.rst @@ -5,9 +5,7 @@ pixel_shuffle .. py:function:: paddle.fluid.layers.pixel_shuffle(x, upscale_factor) -pixel shuffle 层(像素重组层) - -该层将一个形为[N, C, H, W]的张量重新排列成形为 [N, C/r**2, H*r, W*r] 的张量。这样做有利于实现步长(stride)为1/r的高效sub-pixel(亚像素)卷积。详见Shi等人在2016年发表的论文 `Real Time Single Image and Video Super Resolution Using an Efficient Sub Pixel Convolutional Neural Network `_ 。 +该OP将一个形为[N, C, H, W]的Tensor重新排列成形为 [N, C/r**2, H*r, W*r] 的Tensor。这样做有利于实现步长(stride)为1/r的高效sub-pixel(亚像素)卷积。详见Shi等人在2016年发表的论文 `Real Time Single Image and Video Super Resolution Using an Efficient Sub Pixel Convolutional Neural Network `_ 。 .. code-block:: text @@ -16,7 +14,7 @@ pixel shuffle 层(像素重组层) 那么输出张量的形为:[1, 1, 12, 12] 参数: - - **x** (Variable)- 输入Tensor变量。 + - **x** (Variable)- 维度为 :math:`[N_1, N_2, ..., N_k, D]` 的多维Tensor,其中最后一维D是类别数目。数据类型为float32或float64。 - **upscale_factor** (int)- 增大空间分辨率的增大因子 @@ -24,7 +22,7 @@ pixel shuffle 层(像素重组层) 返回类型: Variable -抛出异常: ``ValueError`` - 如果upscale_factor的平方不能整除输入的通道维(C)大小。 +抛出异常: ``ValueError`` - 如果upscale_factor的平方不能整除输入的通道维度(C)的大小。 **示例代码** diff --git a/doc/fluid/api_cn/layers_cn/prior_box_cn.rst b/doc/fluid/api_cn/layers_cn/prior_box_cn.rst index 435eaeb34..19998e3a8 100644 --- a/doc/fluid/api_cn/layers_cn/prior_box_cn.rst +++ b/doc/fluid/api_cn/layers_cn/prior_box_cn.rst @@ -4,28 +4,25 @@ prior_box ------------------------------- .. py:function:: paddle.fluid.layers.prior_box(input,image,min_sizes=None,max_sizes=None,aspect_ratios=[1.0],variance=[0.1,0.1,0.2,0.2],flip=False,clip=False,steps=[0.0,0.0],offset=0.5,name=None,min_max_aspect_ratios_order=False) -**Prior Box操作符** - -为SSD(Single Shot MultiBox Detector)算法生成先验框。输入的每个位产生N个先验框,N由min_sizes,max_sizes和aspect_ratios的数目决定,先验框的尺寸在(min_size,max_size)之间,该尺寸根据aspect_ratios在序列中生成。 +该OP为SSD(Single Shot MultiBox Detector)算法生成候选框。输入的每个位产生N个候选框,N由min_sizes,max_sizes和aspect_ratios的数目决定,候选框的尺寸在(min_size,max_size)之间,该尺寸根据aspect_ratios在序列中生成。 参数: - - **input** (Variable)-输入变量,格式为NCHW - - **image** (Variable)-PriorBoxOp的输入图像数据,布局为NCHW - - **min_sizes** (list|tuple|float值)-生成的先验框的最小尺寸 - - **max_sizes** (list|tuple|None)-生成的先验框的最大尺寸。默认:None - - **aspect_ratios** (list|tuple|float值)-生成的先验框的纵横比。默认:[1.] - - **variance** (list|tuple)-先验框中的变量,会被解码。默认:[0.1,0.1,0.2,0.2] - - **flip** (bool)-是否忽略纵横比。默认:False。 - - **clip** (bool)-是否修建溢界框。默认:False。 - - **step** (list|tuple)-先验框在width和height上的步长。如果step[0] == 0.0/step[1] == 0.0,则自动计算先验框在宽度和高度上的步长。默认:[0.,0.] - - **offset** (float)-先验框中心位移。默认:0.5 - - **name** (str)-先验框操作符名称。默认:None - - **min_max_aspect_ratios_order** (bool)-若设为True,先验框的输出以[min,max,aspect_ratios]的顺序,和Caffe保持一致。请注意,该顺序会影响后面卷基层的权重顺序,但不影响最后的检测结果。默认:False。 - -返回: - 含有两个变量的元组(boxes,variances) - boxes:PriorBox的输出先验框。布局是[H,W,num_priors,4]。H是输入的高度,W是输入的宽度,num_priors是输入每位的总框数 - variances:PriorBox的扩展变量。布局上[H,W,num_priors,4]。H是输入的高度,W是输入的宽度,num_priors是输入每位的总框数 + - **input** (Variable) - 形状为NCHW的4-DTensor,数据类型为float32或float64。 + - **image** (Variable) - PriorBoxOp的输入图像数据,形状为NCHW的4-D Tensor,数据类型为float32或float64。 + - **min_sizes** (list|tuple|float) - 生成的候选框的最小尺寸。 + - **max_sizes** (list|tuple|None) - 生成的候选框的最大尺寸。默认值为None + - **aspect_ratios** (list|tuple|float) - 生成的候选框的长宽比。默认值为[1.]。 + - **variance** (list|tuple) - 在候选框中解码的方差。默认值为[0.1,0.1,0.2,0.2]。 + - **flip** (bool) - 是否翻转。默认值为False。 + - **clip** (bool) - 是否裁剪。默认值为False。 + - **step** (list|tuple) - 候选框在width和height上的步长。如果step[0]等于0.0或者step[1]等于0.0,则自动计算候选框在宽度和高度上的步长。默认:[0.,0.] + - **offset** (float) - 候选框中心位移。默认:0.5 + - **name** (str|None) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。默认值为None。 + - **min_max_aspect_ratios_order** (bool) - 若设为True,候选框的输出以[min, max, aspect_ratios]的顺序输出,和Caffe保持一致。请注意,该顺序会影响后面卷基层的权重顺序,但不影响最后的检测结果。默认:False。 + +返回:含有两个变量的元组,包括: + boxes: 候选框。形状为[H,W,num_priors,4]的4-D Tensor。其中,H是输入的高度,W是输入的宽度,num_priors是输入每位的总框数。 + variances: 候选框的方差,形状为[H,W,num_priors,4]的4-D Tensor。其中,H是输入的高度,W是输入的宽度,num_priors是输入每位的总框数。 返回类型:元组 @@ -42,5 +39,3 @@ prior_box min_sizes=[100.], flip=True, clip=True) - - diff --git a/doc/fluid/api_cn/layers_cn/resize_bilinear_cn.rst b/doc/fluid/api_cn/layers_cn/resize_bilinear_cn.rst index 5c1d548cd..94d8fdaf3 100644 --- a/doc/fluid/api_cn/layers_cn/resize_bilinear_cn.rst +++ b/doc/fluid/api_cn/layers_cn/resize_bilinear_cn.rst @@ -7,7 +7,7 @@ resize_bilinear **注意:** 参数 ``actual_shape`` 将被弃用,请使用 ``out_shape`` 替代。 -根据指定的out_shape执行双线性插值调整输入大小,输出形状按优先级由actual_shape、out_shape和scale指定。 +该OP应用双向性插值法调整输入图片的大小,输出形状按优先级由actual_shape、out_shape和scale指定。 双线性插值是对线性插值的扩展,即二维变量方向上(如h方向和w方向)插值。关键思想是先在一个方向上执行线性插值,然后再在另一个方向上执行线性插值。 @@ -52,16 +52,16 @@ align_corners和align_mode是可选参数,插值的计算方法可以由它们 参数: - - **input** (Variable) - 输入是shape为(num_batches, channels, in_h, in_w)的4-D张量。 - - **out_shape** (list|tuple|Variable|None) - 调整双线性层的输出形状,形式为(out_h, out_w)。默认值:None。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者shape为[1]的变量。如果 :code:`out_shape` 是变量,则其维度大小为1。 - - **scale** (float|Variable|None) - 用于输入高度或宽度的乘数因子。out_shape和scale至少要设置一个。out_shape的优先级高于scale。默认值:None。 - - **name** (str|None) - 输出变量名。 - - **actual_shape** (Variable) - 可选输入,用于动态指定输出形状。如果指定actual_shape,图像将根据给定的形状调整大小,而不是根据指定形状的 :code:`out_shape` 和 :code:`scale` 进行调整。也就是说, :code:`actual_shape` 具有最高的优先级。如果希望动态指定输出形状,建议使用 :code:`out_shape` , 因为 :code:`out_shape` 未来将被弃用。在使用actual_shape指定输出形状时,还需要设置out_shape和scale之一,否则在图形构建阶段会出现错误。默认值:None - - **align_corners** (bool)- 一个可选的bool型参数,如果为True,则将输入和输出张量的4个角落像素的中心对齐,并保留角点像素的值。 默认值:True - - **align_mode** (int)- 双线性插值的可选项。 可以是'0'代表src_idx = scale *(dst_indx + 0.5)-0.5;可以为'1' ,代表src_idx = scale * dst_index。 + - **input** (Variable) - 输入维度为[num_batches, channels, in_h, in_w]的4-D Tensor。 + - **out_shape** (list|tuple|Variable|None) - 双线性层的输出形状,维度为[out_h, out_w]的二维Tensor。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者维度为[1]的变量。如果 :code:`out_shape` 是变量,则其维度大小为1。默认值为None。 + - **scale** (float|Variable|None) - 用于输入高度或宽度的乘数因子。out_shape和scale至少要设置一个。out_shape的优先级高于scale。默认值为None。 + - **name** (str|None) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。默认值为None。 + - **actual_shape** (Variable) - 可选输入,用于动态指定输出形状。如果指定actual_shape,图像将根据给定的形状调整大小,而不是根据指定形状的 :code:`out_shape` 和 :code:`scale` 进行调整。也就是说, :code:`actual_shape` 具有最高的优先级。如果希望动态指定输出形状,建议使用 :code:`out_shape` , 因为 :code:`out_shape` 未来将被弃用。在使用actual_shape指定输出形状时,还需要设置out_shape和scale之一,否则在图形构建阶段会出现错误。默认值为None。 + - **align_corners** (bool)- 一个可选的bool型参数,如果为True,则将输入和输出张量的4个角落像素的中心对齐,并保留角点像素的值。 默认值为True + - **align_mode** (int)- 双线性插值的可选项。 可以是'0'代表src_idx = scale *(dst_indx + 0.5)-0.5;如果为'1' ,代表src_idx = scale * dst_index。 -返回: 4D张量,shape为(num_batches, channels, out_h, out_w) +返回:维度为[num_batches, channels, out_h, out_w]的4-D Tensor。 **代码示例** diff --git a/doc/fluid/api_cn/layers_cn/resize_nearest_cn.rst b/doc/fluid/api_cn/layers_cn/resize_nearest_cn.rst index 40f8ffcca..22f65937c 100644 --- a/doc/fluid/api_cn/layers_cn/resize_nearest_cn.rst +++ b/doc/fluid/api_cn/layers_cn/resize_nearest_cn.rst @@ -5,7 +5,7 @@ resize_nearest .. py:function:: paddle.fluid.layers.resize_nearest(input, out_shape=None, scale=None, name=None, actual_shape=None, align_corners=True) -该层对输入进行放缩,在第三维(高度方向)和第四维(宽度方向)进行最邻近插值(nearest neighbor interpolation)操作。 +该OP对输入图片进行大小调整,在第三维(高度方向)和第四维(宽度方向)进行最邻近插值(nearest neighbor interpolation)操作。 输出形状按优先级顺序依据 ``actual_shape`` , ``out_shape`` 和 ``scale`` 而定。 **注意:** 参数 ``actual_shape`` 将被弃用,请使用 ``out_shape`` 替代。 @@ -47,16 +47,17 @@ resize_nearest 最邻近插值的详细介绍请参照: `Wiki Nearest-neighbor interpolation `_ - 参数: - - **input** (Variable) - 输入是shape为(num_batches, channels, in_h, in_w)的4-D张量。 - - **out_shape** (list|tuple|Variable|None) - 调整双线性层的输出形状,形式为(out_h, out_w)。默认值:None。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者shape为[1]的变量。如果 :code:`out_shape` 是变量,则其维度大小为1。 - - **scale** (float|Variable|None) – 输入高、宽的乘法器。 ``out_shape`` 和 ``scale`` 二者至少设置其一。 ``out_shape`` 具有比 ``scale`` 更高的优先级。 默认: None - - **name** (str|None) – 输出变量的命名 - - **actual_shape** (Variable) - 可选输入,用于动态指定输出形状。如果指定actual_shape,图像将根据给定的形状调整大小,而不是根据指定形状的 :code:`out_shape` 和 :code:`scale` 进行调整。也就是说, :code:`actual_shape` 具有最高的优先级。如果希望动态指定输出形状,建议使用 :code:`out_shape` , 因为 :code:`out_shape` 未来将被弃用。在使用actual_shape指定输出形状时,还需要设置out_shape和scale之一,否则在图形构建阶段会出现错误。默认值:None - - **align_corners** (bool)- 一个可选的bool型参数,如果为True,则将输入和输出张量的4个角落像素的中心对齐,并保留角点像素的值。 默认值:True - -返回:形为(num_batches, channels, out_h, out_w)的四维张量 + - **input** (Variable) - 输入维度为[num_batches, channels, in_h, in_w]的4-D Tensor。 + - **out_shape** (list|tuple|Variable|None) - 双线性插值法调整后的输出,维度为[out_h, out_w]的2-D Tensor。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者shape为[1]的变量。如果 :code:`out_shape` 是变量,则其维度大小为1。默认值为None。 + - **scale** (float|Variable|None) – 输入高宽的乘数因子。 ``out_shape`` 和 ``scale`` 二者至少设置其一。 ``out_shape`` 具有比 ``scale`` 更高的优先级。 默认值为None。 + - **name** (str|None) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。默认值为None。 + - **actual_shape** (Variable) - 可选输入,用于动态指定输出形状。如果指定actual_shape,图像将根据给定的形状调整大小,而不是根据指定形状的 :code:`out_shape` 和 :code:`scale` 进行调整。也就是说, :code:`actual_shape` 具有最高的优先级。如果希望动态指定输出形状,建议使用 :code:`out_shape` , 因为 :code:`out_shape` 未来将被弃用。在使用actual_shape指定输出形状时,还需要设置out_shape和scale之一,否则在图形构建阶段会出现错误。默认值为None。 + - **align_corners** (bool)- 一个可选的bool型参数,如果为True,则将输入和输出张量的4个角落像素的中心对齐,并保留角点像素的值。 默认值为True。 + +返回:维度为[num_batches, channels, out_h, out_w]的4-D Tensor。 + +返回类型:Variable **代码示例** diff --git a/doc/fluid/api_cn/layers_cn/sampling_id_cn.rst b/doc/fluid/api_cn/layers_cn/sampling_id_cn.rst index 27544900d..dc444fb1a 100644 --- a/doc/fluid/api_cn/layers_cn/sampling_id_cn.rst +++ b/doc/fluid/api_cn/layers_cn/sampling_id_cn.rst @@ -5,18 +5,18 @@ sampling_id .. py:function:: paddle.fluid.layers.sampling_id(x, min=0.0, max=1.0, seed=0, dtype='float32') -sampling_id算子。用于从输入的多项分布中对id进行采样的图层。为一个样本采样一个id。 +该OP从输入的多项分布中进行采样。 参数: - - **x** (Variable)- softmax的输入张量(Tensor)。2-D形状[batch_size,input_feature_dimensions] - - **min** (Float)- 随机的最小值。(浮点数,默认为0.0) - - **max** (Float)- 随机的最大值。(float,默认1.0) - - **seed** (Float)- 用于随机数引擎的随机种子。0表示使用系统生成的种子。请注意,如果seed不为0,则此算子将始终每次生成相同的随机数。(int,默认为0) - - **dtype** (np.dtype | core.VarDesc.VarType | str)- 输出数据的类型为float32,float_16,int等。 + - **x** (Variable)- 输入Tensor。一个形如[batch_size,input_feature_dimensions]的2-D Tensor。 + - **min** (Float)- 随机的最小值。默认值为为0.0。 + - **max** (Float)- 随机的最大值。默认值为1.0。 + - **seed** (int)- 随机种子。0表示使用系统生成的种子。请注意,如果seed不为0,则此算子将始终每次生成相同的随机数。默认值为0 + - **dtype** (np.dtype | core.VarDesc.VarType | str)- 指定输出数据的类型。 -返回: Id采样的数据张量。 +返回:采样的数据Tensor -返回类型: 输出(Variable)。 +返回类型:Variable **代码示例:** diff --git a/doc/fluid/api_cn/layers_cn/shuffle_channel_cn.rst b/doc/fluid/api_cn/layers_cn/shuffle_channel_cn.rst index 11ff40cc5..a91ce5ea5 100644 --- a/doc/fluid/api_cn/layers_cn/shuffle_channel_cn.rst +++ b/doc/fluid/api_cn/layers_cn/shuffle_channel_cn.rst @@ -5,9 +5,7 @@ shuffle_channel .. py:function:: paddle.fluid.layers.shuffle_channel(x, group, name=None) -**Shuffle Channel 运算(通道重排运算)** - -该算子将输入 ``x`` 的通道混洗重排。 它将每个组中的输入通道分成 ``group`` 个子组,并通过逐个从每个子组中选择元素来获得新的顺序。 +该OP将输入 ``x`` 的通道混洗重排。 它将每个组中的输入通道分成 ``group`` 个子组,并通过逐一从每个子组中选择元素来获得新的顺序。 请参阅 https://arxiv.org/pdf/1707.01083.pdf @@ -45,12 +43,12 @@ shuffle_channel [0.8, 0.9]]]] 参数: - - **x** (Variable) – 输入张量变量。 应是形状为[N,C,H,W]的4-D张量 + - **x** (Variable) – 输入Tensor。 维度为[N,C,H,W]的4-D Tensor。 - **group** (int) – 表示子组的数目,它应该整除通道数。 -返回:通道混洗结果是一个张量变量,其形状和类型与输入相同。 +返回:一个形状和类型与输入相同的Tensor。 -返回类型:输出(Variable) +返回类型:Variable **代码示例:** diff --git a/doc/fluid/api_cn/layers_cn/square_error_cost_cn.rst b/doc/fluid/api_cn/layers_cn/square_error_cost_cn.rst index 55f6d275d..d740d23dd 100644 --- a/doc/fluid/api_cn/layers_cn/square_error_cost_cn.rst +++ b/doc/fluid/api_cn/layers_cn/square_error_cost_cn.rst @@ -5,26 +5,19 @@ square_error_cost .. py:function:: paddle.fluid.layers.square_error_cost(input,label) -方差估计层(Square error cost layer) +该OP用于计算预测值和目标值的方差估计。 -该层接受输入预测值和目标值,并返回方差估计 - -对于预测值X和目标值Y,公式为: +对于预测值input和目标值label,公式为: .. math:: - Out = (X-Y)^{2} - -在以上等式中: - - **X** : 输入预测值,张量(Tensor) - - **Y** : 输入目标值,张量(Tensor) - - **Out** : 输出值,维度和X的相同 + Out = (input-label)^{2} 参数: - - **input** (Variable) - 输入张量(Tensor),带有预测值 - - **label** (Variable) - 标签张量(Tensor),带有目标值 + - **input** (Variable) - 预测值,维度为 :math:`[N_1, N_2, ..., N_k, D]` 的多维Tensor,其中最后一维D是类别数目。数据类型为float32或float64。 + - **label** (Variable) - 目标值,维度为 :math:`[N_1, N_2, ..., N_k, D]` 的多维Tensor,其中最后一维D是类别数目。数据类型为float32或float64。 -返回:张量变量,存储输入张量和标签张量的方差 +返回:预测值和目标值的方差 返回类型:变量(Variable) -- GitLab