!35608 update reflectionpad api

Merge pull request !35608 from shaojunsong/code_docs_api_ch
This commit is contained in:
i-robot 2022-06-09 06:40:31 +00:00 committed by Gitee
commit 907b226d86
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 24 additions and 30 deletions

View File

@ -1,13 +1,13 @@
mindspore.nn.ReflectionPad1d
============================
.. py:class:: mindspore.nn.ReflectionPad1d(paddings)
.. py:class:: mindspore.nn.ReflectionPad1d(padding)
根据 `paddings` 对输入 `x` 进行填充。
根据 `padding` 对输入 `x` 进行填充。
**参数:**
- **paddings** (tuple/int) - 填充大小如果输入为int, 则对所有边界进行相同大小的padding如果是tuple则为(pad_left, pad_right)。
- **padding** (tuple/int) - 填充大小, 如果输入为int 则对所有边界进行相同大小的填充; 如果是tuple则为(pad_left, pad_right)。
.. code-block::
@ -22,18 +22,16 @@ mindspore.nn.ReflectionPad1d
**输入:**
- **x** (Tensor) - 输入Tensor, shape为 :math:`(C, W_in)`:math:`(N, C, W_in)`
- **x** (Tensor) - 输入Tensor, 2D或3D。shape为 :math:`(C, W_in)`:math:`(N, C, W_in)`
**输出:**
Tensor填充后的Tensor, shape为 :math:`(C, W_out)`:math:`(N, C, W_out)`。其中 :math:`W_out = W_in + pad_left + pad_right`
- 对 `x` 使用对称轴进行对称复制的方式进行填充(复制时不包括对称轴)。例如 `x` 为[[[0, 1, 2, 3], [4, 5, 6, 7]]] `paddings` 为(3, 1),则输出为[[[3, 2, 1, 0, 1, 2, 3, 2], [7, 6, 5, 4, 5, 6, 7, 6]]]。
Tensor填充后的Tensor, shape为 :math:`(C, W_out)`:math:`(N, C, W_out)`。其中 :math:`W_out = W_in + pad_left + pad_right`
**异常:**
- **TypeError** - `padding` 不是tuple或integer
- **ValueError** - `padding` 中存在不是integer的元素
- **TypeError** - `padding` 不是tuple或int。
- **TypeError** - `padding` 中存在不是int的元素
- **ValueError** - `padding` 是tuple且长度不能被2整除。
- **ValueError** - `padding` 是tuple且存在负数。
- **ValueError** - `padding` 是tuple且和tensor的维度不匹配。
- **ValueError** - `padding` 是tuple长度和tensor的维度不匹配。

View File

@ -1,13 +1,13 @@
mindspore.nn.ReflectionPad2d
============================
.. py:class:: mindspore.nn.ReflectionPad2d(paddings)
.. py:class:: mindspore.nn.ReflectionPad2d(padding)
根据 `paddings` 对输入 `x` 进行填充。
根据 `padding` 对输入 `x` 进行填充。
**参数:**
- **paddings** (tuple/int) - 填充大小如果输入为integer, 则对所有边界进行相同大小的padding如果是tuple则顺序为(pad_left, pad_right, pad_up, pad_down)。
- **padding** (tuple/int) - 填充大小, 如果输入为int 则对所有边界进行相同大小的填充; 如果是tuple则顺序为(pad_left, pad_right, pad_up, pad_down)。
.. code-block::
@ -27,14 +27,12 @@ mindspore.nn.ReflectionPad2d
**输出:**
Tensor填充后的Tensor, shape为 :math:`(C, H_out, W_out)`:math:`(N, C, H_out, W_out)`。其中 :math:`H_out = H_in + pad_up + pad_down`,:math:`W_out = W_in + pad_left + pad_right, H_out = H_in`
- 对 `x` 使用对称轴进行对称复制的方式进行填充(复制时不包括对称轴)。例如 `x` 为[[[[0, 1, 2], [3, 4, 5], [6, 7, 8]]]] `paddings` 为(1, 1, 2, 0),则输出为[[[[7., 6., 7., 8., 7.], [4., 3., 4., 5., 4.], [1., 0., 1., 2., 1.], [4., 3., 4., 5., 4.], [7., 6., 7., 8., 7.]]]]。
Tensor填充后的Tensor, shape为 :math:`(C, H_out, W_out)`:math:`(N, C, H_out, W_out)`。其中 :math:`H_out = H_in + pad_up + pad_down`,:math:`W_out = W_in + pad_left + pad_right`
**异常:**
- **TypeError** - `padding` 不是tuple或integer
- **ValueError** - `padding` 中存在不是integer的元素
- **TypeError** - `padding` 不是tuple或int。
- **TypeError** - `padding` 中存在不是int的元素
- **ValueError** - `padding` 是tuple且长度不能被2整除。
- **ValueError** - `padding` 是tuple且存在负数。
- **ValueError** - `padding` 是tuple且和tensor的维度不匹配。
- **ValueError** - `padding` 是tuple长度和tensor的维度不匹配。

View File

@ -91,16 +91,15 @@ class ReflectionPad1d(_ReflectionPadNd):
If padding is a tuple: uses (pad_left, pad_right, pad_up, pad_down) to pad.
Inputs:
Tensor, 2D or 3D
x (Tensor): 2D or 3D, shape: :math:`(C, W_{in})` or :math:`(N, C, W_{in})`.
Outputs:
Tensor, after padding.
Suppose the tensor has dimension (N, C, W_in), the padded dimension will become (N, C, W_out),
where W_out = W_in + pad_left + pad_right
Tensor, after padding. Shape: :math:`(C, W_{out})` or :math:`(N, C, W_{out})`,
where :math:`W_{out} = W_{in} + pad_{left} + pad_{right}`.
Raises:
TypeError: If 'padding' is not a tuple or int.
TypeError: If there is an element in 'padding' that is not int64.
TypeError: If there is an element in 'padding' that is not int.
ValueError: If the length of 'padding' is not divisible by 2.
ValueError: If there is an element in 'padding' that is negative.
ValueError: If the there is a dimension mismatch between the padding and the tensor.
@ -138,16 +137,15 @@ class ReflectionPad2d(_ReflectionPadNd):
If padding is a tuple: uses (pad_left, pad_right, pad_up, pad_down) to pad.
Inputs:
Tensor, 3D or 4D
x (Tensor): 3D or 4D, shape: :math:`(C, H_{in}, W_{out})` or :math:`(N, C, H_{out}, W_{out})`.
Output:
Tensor, after padding.
Suppose the tensor has dimension (N, C, H_in, W_in), the padded dimension will become (N, C, H_out, W_out),
where W_out = W_in + pad_left + pad_right, H_out = H_in + pad_up + pad_down
Outputs:
Tensor, after padding. Shape: :math:`(C, H_{out}, W_{out})` or :math:`(N, C, H_{out}, W_{out})`,
where :math:`H_{out} = H_{in} + pad_{up} + pad_{down}`, :math:`W_{out} = W_{in} + pad_{left} + pad_{right}`.
Raises:
TypeError: If 'padding' is not a tuple or int.
TypeError: If there is an element in 'padding' that is not int64.
TypeError: If there is an element in 'padding' that is not int.
ValueError: If the length of 'padding' is not divisible by 2.
ValueError: If there is an element in 'padding' that is negative.
ValueError: If the there is a dimension mismatch between the padding and the tensor.