Skip to content

Commit

Permalink
Update docs for upsample/Upsample/interpolate (#6505)
Browse files Browse the repository at this point in the history
* update upsample Upsample interpolate

* update docs

* update docs

* update docs
  • Loading branch information
NKNaN committed Mar 1, 2024
1 parent 3723ffb commit d6e13c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions docs/api/paddle/nn/Upsample_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
Upsample
-------------------------------

.. py:class:: paddle.nn.Upsample(size=None, scale_factor=None, mode='nearest', align_corners=False, align_mode=0, data_format='NCHW', name=None)
.. py:class:: paddle.nn.Upsample(size=None, scale_factor=None, mode='nearest', align_corners=False, align_mode=0, data_format=None, name=None)
用于调整一个 batch 中图片的大小。

输入为 3-D Tensor 时形状为(num_batches, channels, in_w),输入为 4-D Tensor 时形状为(num_batches, channels, in_h, in_w)或者(num_batches, in_h, in_w, channels),输入为 5-D Tensor 时形状为(num_batches, channels, in_d, in_h, in_w)或者(num_batches, in_d, in_h, in_w, channels),并且调整大小只适用于深度,高度和宽度对应的维度。
输入为 3-D Tensor 时形状为(num_batches, channels, in_w)或者(num_batches, in_w, channels),输入为 4-D Tensor 时形状为(num_batches, channels, in_h, in_w)或者(num_batches, in_h, in_w, channels),输入为 5-D Tensor 时形状为(num_batches, channels, in_d, in_h, in_w)或者(num_batches, in_d, in_h, in_w, channels),并且调整大小只适用于深度,高度和宽度对应的维度。

支持的插值方法:

Expand Down Expand Up @@ -155,12 +155,12 @@ https://en.wikipedia.org/wiki/Bicubic_interpolation
- **mode** (str,可选) - 插值方法。支持"bilinear"或"trilinear"或"nearest"或"bicubic"或"linear"或"area"。默认值为"nearest"。
- **align_corners** (bool,可选) - 一个可选的 bool 型参数,如果为 True,则将输入和输出 Tensor 的 4 个角落像素的中心对齐,并保留角点像素的值。默认值为 False。
- **align_mode** (int,可选) - 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_indx + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。默认值为 0。
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。对于 3-D Tensor,支持 NCW(num_batches, channels, width)或者 NWC(num_batches, width, channels),对于 4-D Tensor,支持 NCHW(num_batches, channels, height, width) 或者 NHWC(num_batches, height, width, channels),对于 5-D Tensor,支持 NCDHW(num_batches, channels, depth, height, width)或者 NDHWC(num_batches, depth, height, width, channels),默认值:'NCHW'
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。支持的值有:"NCW"、"NWC"、"NCHW"、"NHWC"、"NCDHW"、"NDHWC"。默认值为 None,此时若输入是 3-D Tensor, ``data_format`` 将默认为"NCW";若输入是 4—D Tensor, 将默认为"NCHW";若输入是 5—D Tensor, 将默认为"NCDHW"
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
::::::::::::
3-D Tensor,形状为(num_batches, channels, out_w)或者(num_batches, out_w, channels);4-D Tensor,形状为 (num_batches, channels, out_h, out_w) 或 (num_batches, out_h, out_w, channels);或者 5-D Tensor,形状为 (num_batches, channels, out_d, out_h, out_w) 或 (num_batches, out_d, out_h, out_w, channels)
返回用于计算 Upsample 的可调用对象


代码示例
Expand Down
10 changes: 5 additions & 5 deletions docs/api/paddle/nn/functional/interpolate_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
interpolate
-------------------------------

.. py:function:: paddle.nn.functional.interpolate(x, size=None, scale_factor=None, mode='nearest', align_corners=False, align_mode=0, data_format='NCHW', name=None)
.. py:function:: paddle.nn.functional.interpolate(x, size=None, scale_factor=None, mode='nearest', align_corners=False, align_mode=0, data_format=None, name=None)
调整一个 batch 中图片的大小。

输入为 3-D Tensor 形状为(num_batches, channels, in_w),输入为 4-D Tensor 时形状为(num_batches, channels, in_h, in_w)或者(num_batches, in_h, in_w, channels),输入为 5-D Tensor 时形状为(num_batches, channels, in_d, in_h, in_w)或者(num_batches, in_d, in_h, in_w, channels),并且调整大小只适用于深度,高度和宽度对应的维度。
输入为 3-D Tensor 时形状为(num_batches, channels, in_w)或者(num_batches, in_w, channels),输入为 4-D Tensor 时形状为(num_batches, channels, in_h, in_w)或者(num_batches, in_h, in_w, channels),输入为 5-D Tensor 时形状为(num_batches, channels, in_d, in_h, in_w)或者(num_batches, in_d, in_h, in_w, channels),并且调整大小只适用于深度,高度和宽度对应的维度。

支持的插值方法:

Expand Down Expand Up @@ -141,18 +141,18 @@ https://en.wikipedia.org/wiki/Bicubic_interpolation
参数
::::::::::::

- **x** (Tensor) - 4-D 或 5-D Tensor,数据类型为 float32、float64 或 uint8,其数据格式由参数 ``data_format`` 指定。
- **x** (Tensor) - 3-D,4-D 或 5-D Tensor,数据类型为 float32、float64 或 uint8,其数据格式由参数 ``data_format`` 指定。如果没有指定 ``data_format`` 参数,其数据格式将由维度决定,具体请参照 ``data_format`` 参数
- **size** (list|tuple|Tensor|None) - 输出 Tensor,输入为 4D Tensor 时,形状为为(out_h, out_w)的 2-D Tensor。输入为 5-D Tensor 时,形状为(out_d, out_h, out_w)的 3-D Tensor。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者形状为[]的 Tensor。如果 :code:`out_shape` 是 Tensor,则其为 1D Tensor。默认值为 None。
- **scale_factor** (float|Tensor|list|tuple|None)-输入的高度或宽度的乘数因子。out_shape 和 scale 至少要设置一个。out_shape 的优先级高于 scale。默认值为 None。如果 scale_factor 是一个 list 或 tuple,它必须与输入的 shape 匹配。
- **mode** (str,可选) - 插值方法。支持"bilinear"或"trilinear"或"nearest"或"bicubic"或"linear"或"area"。默认值为"nearest"。
- **align_corners** (bool,可选) - 一个可选的 bool 型参数,如果为 True,则将输入和输出 Tensor 的 4 个角落像素的中心对齐,并保留角点像素的值。默认值为 False。
- **align_mode** (int,可选) - 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_indx + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。默认值:0。
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。对于 4-D Tensor,支持 NCHW(num_batches, channels, height, width) 或者 NHWC(num_batches, height, width, channels),对于 5-D Tensor,支持 NCDHW(num_batches, channels, depth, height, width)或者 NDHWC(num_batches, depth, height, width, channels),默认值:'NCHW'
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。支持的值有:"NCW"、"NWC"、"NCHW"、"NHWC"、"NCDHW"、"NDHWC"。默认值为 None,此时若输入是 3-D Tensor, ``data_format`` 将默认为"NCW";若输入是 4—D Tensor, 将默认为"NCHW";若输入是 5—D Tensor, 将默认为"NCDHW"
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
::::::::::::
4-D Tensor,形状为 (num_batches, channels, out_h, out_w) 或 (num_batches, out_h, out_w, channels);或者 5-D Tensor,形状为 (num_batches, channels, out_d, out_h, out_w) 或 (num_batches, out_d, out_h, out_w, channels)
3-D,4-D,或 5-D Tensor,数据格式与输入 ``x`` 一致


代码示例
Expand Down
10 changes: 5 additions & 5 deletions docs/api/paddle/nn/functional/upsample_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
upsample
-------------------------------

.. py:function:: paddle.nn.functional.upsample(x, size=None, scale_factor=None, mode='nearest', align_corners=False, align_mode=0, data_format='NCHW', name=None)
.. py:function:: paddle.nn.functional.upsample(x, size=None, scale_factor=None, mode='nearest', align_corners=False, align_mode=0, data_format=None, name=None)
调整一个 batch 中图片的大小。

输入为 4-D Tensor 时形状为(num_batches, channels, in_h, in_w)或者(num_batches, in_h, in_w, channels),输入为 5-D Tensor 时形状为(num_batches, channels, in_d, in_h, in_w)或者(num_batches, in_d, in_h, in_w, channels),并且调整大小只适用于深度,高度和宽度对应的维度。
输入为 3-D Tensor 时形状为(num_batches, channels, in_w)或者(num_batches, in_w, channels),输入为 4-D Tensor 时形状为(num_batches, channels, in_h, in_w)或者(num_batches, in_h, in_w, channels),输入为 5-D Tensor 时形状为(num_batches, channels, in_d, in_h, in_w)或者(num_batches, in_d, in_h, in_w, channels),并且调整大小只适用于深度,高度和宽度对应的维度。

支持的插值方法:

Expand Down Expand Up @@ -140,18 +140,18 @@ https://en.wikipedia.org/wiki/Bicubic_interpolation
参数
::::::::::::

- **x** (Tensor) - 4-D 或 5-D Tensor,数据类型为 float32、float64 或 uint8,其数据格式由参数 ``data_format`` 指定。
- **x** (Tensor) - 3-D,4-D 或 5-D Tensor,数据类型为 float32、float64 或 uint8,其数据格式由参数 ``data_format`` 指定。如果没有指定 ``data_format`` 参数,其数据格式将由维度决定,具体请参照 ``data_format`` 参数
- **size** (list|tuple|Tensor|None) - 输出 Tensor,输入为 4D Tensor 时,形状为为(out_h, out_w)的 2-D Tensor。输入为 5-D Tensor 时,形状为(out_d, out_h, out_w)的 3-D Tensor。如果 :code:`out_shape` 是列表,每一个元素可以是整数或者形状为[]的变量。如果 :code:`out_shape` 是变量,则其维度大小为 1。默认值为 None。
- **scale_factor** (float|Tensor|list|tuple|None)-输入的高度或宽度的乘数因子。out_shape 和 scale 至少要设置一个。out_shape 的优先级高于 scale。默认值为 None。如果 scale_factor 是一个 list 或 tuple,它必须与输入的 shape 匹配。
- **mode** (str,可选) - 插值方法。支持"bilinear"或"trilinear"或"nearest"或"bicubic"或"linear"或"area"。默认值为"nearest"。
- **align_mode** (int,可选)- 双线性插值的可选项。可以是 '0' 代表 src_idx = scale *(dst_indx + 0.5)-0.5;如果为'1',代表 src_idx = scale * dst_index。
- **align_corners** (bool,可选) - 一个可选的 bool 型参数,如果为 True,则将输入和输出 Tensor 的 4 个角落像素的中心对齐,并保留角点像素的值。默认值为 True
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。对于 4-D Tensor,支持 NCHW(num_batches, channels, height, width) 或者 NHWC(num_batches, height, width, channels),对于 5-D Tensor,支持 NCDHW(num_batches, channels, depth, height, width)或者 NDHWC(num_batches, depth, height, width, channels),默认值:'NCHW'
- **data_format** (str,可选) - 指定输入的数据格式,输出的数据格式将与输入保持一致。支持的值有:"NCW"、"NWC"、"NCHW"、"NHWC"、"NCDHW"、"NDHWC"。默认值为 None,此时若输入是 3-D Tensor, ``data_format`` 将默认为"NCW";若输入是 4—D Tensor, 将默认为"NCHW";若输入是 5—D Tensor, 将默认为"NCDHW"
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
::::::::::::
4-D Tensor,形状为 (num_batches, channels, out_h, out_w) 或 (num_batches, out_h, out_w, channels);或者 5-D Tensor,形状为 (num_batches, channels, out_d, out_h, out_w) 或 (num_batches, out_d, out_h, out_w, channels)
3-D,4-D,或 5-D Tensor,数据格式与输入 ``x`` 一致


代码示例
Expand Down

0 comments on commit d6e13c0

Please sign in to comment.