!48424 expand value range of output_size in nn.MaxUnpoolnd

Merge pull request !48424 from ZhidanLiu/master
This commit is contained in:
i-robot 2023-02-06 07:59:49 +00:00 committed by Gitee
commit 36414c2c87
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 23 additions and 21 deletions

View File

@ -25,7 +25,7 @@ mindspore.nn.MaxUnpool1d
数据类型必须是int32或int64。
- **output_size** (tuple[int], 可选) - 输出shape。默认值None。
如果output_size为()那么输出shape根据 `kernel_size``stride``padding` 计算得出。
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, H)` :math:`(C, H)` ,取值范围需满足:
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, H)` :math:`(C, H)`:math:`(H)` ,取值范围需满足:
:math:`[(N, C, H_{out} - stride[0]), (N, C, H_{out} + stride[0])]`
输出:

View File

@ -29,7 +29,7 @@ mindspore.nn.MaxUnpool2d
数据类型必须是int32或int64。
- **output_size** (tuple[int] 可选) - 输出shape。默认值None。
如果output_size为()那么输出shape根据 `kernel_size``stride``padding` 计算得出。
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, H, W)` :math:`(C, H, W)` ,取值范围需满足:
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, H, W)` :math:`(C, H, W)`:math:`(H, W)` ,取值范围需满足:
:math:`[(N, C, H_{out} - stride[0], W_{out} - stride[1]), (N, C, H_{out} + stride[0], W_{out} + stride[1])]`
输出:

View File

@ -31,7 +31,7 @@ mindspore.nn.MaxUnpool3d
:math:`[0, D_{in} \times H_{in} \times W_{in} - 1]` 。数据类型必须是int32或int64。
- **output_size** (tuple[int], 可选) - 输出shape。默认值None。
如果output_size为()那么输出shape根据 `kernel_size``stride``padding` 计算得出。
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, D, H, W)` :math:`(C, D, H, W)`
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, D, H, W)` :math:`(C, D, H, W)`:math:`(D, H, W)`
取值范围需满足:
:math:`[(N, C, D_{out} - stride[0], H_{out} - stride[1], W_{out} - stride[2]), (N, C, D_{out} + stride[0], H_{out} + stride[1], W_{out} + stride[2])]`

View File

@ -23,7 +23,7 @@ mindspore.ops.max_unpool1d
- **padding** (Union[int, tuple[int]]) - 填充值。默认值0。
- **output_size** (tuple[int], 可选) - 输出shape。默认值None。
如果output_size为()那么输出shape根据 `kernel_size``stride``padding` 计算得出。
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, H)` :math:`(C, H)` ,取值范围需满足:
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, H)` :math:`(C, H)`:math:`(H)`,取值范围需满足:
:math:`[(N, C, H_{out} - stride[0]), (N, C, H_{out} + stride[0])]`
返回:

View File

@ -27,7 +27,7 @@ mindspore.ops.max_unpool2d
若为tuple类型则tuple中的两个值分别代表长宽方向填充的大小。
- **output_size** (tuple[int],可选) - 输出shape。默认值None。
如果output_size为()那么输出shape根据 `kernel_size``stride``padding` 计算得出。
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, H, W)` :math:`(C, H, W)` ,取值范围需满足:
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, H, W)` :math:`(C, H, W)`:math:`(H, W)` ,取值范围需满足:
:math:`[(N, C, H_{out} - stride[0], W_{out} - stride[1]), (N, C, H_{out} + stride[0], W_{out} + stride[1])]`
返回:

View File

@ -29,7 +29,7 @@ mindspore.ops.max_unpool3d
若为tuple类型则tuple中的三个值分别代表深度、长和宽方向填充的大小。
- **output_size** (tuple[int], 可选) - 输出shape。默认值None。
如果output_size为()那么输出shape根据 `kernel_size``stride``padding` 计算得出。
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, D, H, W)` :math:`(C, D, H, W)`
如果output_size不为(),那么 `output_size` 必须满足格式 :math:`(N, C, D, H, W)` :math:`(C, D, H, W)`:math:`(D, H, W)`
取值范围需满足:
:math:`[(N, C, D_{out} - stride[0], H_{out} - stride[1], W_{out} - stride[2]), (N, C, D_{out} + stride[0], H_{out} + stride[1], W_{out} + stride[2])]`

View File

@ -1438,8 +1438,8 @@ class MaxUnpool1d(Cell):
Data type must be in int32 or int64.
- **output_size** (tuple[int], optional) - The output size. Default: None.
If output_size == (), then the shape of output computed by kernel_size, stride and padding.
If output_size != (), then output_size must be :math:`(N, C, H)` or
:math:`(C, H)` and output_size must belong to
If output_size != (), then output_size must be :math:`(N, C, H)` , :math:`(C, H)` or
:math:`(H)` and output_size must belong to
:math:`[(N, C, H_{out} - stride[0]), (N, C, H_{out} + stride[0])]`.
Outputs:
@ -1470,8 +1470,8 @@ class MaxUnpool1d(Cell):
def __init__(self, kernel_size, stride=None, padding=0):
"""Initialize MaxUnpool1d."""
super(MaxUnpool1d, self).__init__()
if not stride:
stride = 0
if stride is None:
stride = kernel_size
self.kernel_size = kernel_size
self.stride = stride
self.padding = padding
@ -1525,7 +1525,8 @@ class MaxUnpool2d(Cell):
Data type must be in int32 or int64.
- **output_size** (tuple[int], optional) - The output size. Default: None.
If output_size == (), then the shape of output computed by kernel_size, stride and padding.
If output_size != (), then output_size must be :math:`(N, C, H, W)` and output_size must belong to
If output_size != (), then output_size must be :math:`(N, C, H, W)`, :math:`(C, H, W)` or
:math:`(H, W)` and output_size must belong to
:math:`[(N, C, H_{out} - stride[0], W_{out} - stride[1]),
(N, C, H_{out} + stride[0], W_{out} + stride[1])]`.
@ -1559,8 +1560,8 @@ class MaxUnpool2d(Cell):
def __init__(self, kernel_size, stride=None, padding=0):
"""Initialize MaxUnpool2d."""
super(MaxUnpool2d, self).__init__()
if not stride:
stride = 0
if stride is None:
stride = kernel_size
self.kernel_size = kernel_size
self.stride = stride
self.padding = padding
@ -1617,8 +1618,8 @@ class MaxUnpool3d(Cell):
Data type must be in int32 or int64.
- **output_size** (tuple[int], optional) - The output size. Default: None.
If output_size == (), then the shape of output computed by kernel_size, stride and padding.
If output_size != (), then output_size must be :math:`(N, C, D, H, W)` or :math:`(C, D, H, W)` and
output_size must belong to
If output_size != (), then output_size must be :math:`(N, C, D, H, W)` , :math:`(C, D, H, W)` or
:math:`(D, H, W)` and output_size must belong to
:math:`[(N, C, D_{out} - stride[0], H_{out} - stride[1], W_{out} - stride[2]),
(N, C, D_{out} + stride[0], H_{out} + stride[1], W_{out} + stride[2])]`.
@ -1651,8 +1652,8 @@ class MaxUnpool3d(Cell):
"""
def __init__(self, kernel_size, stride=None, padding=0):
super(MaxUnpool3d, self).__init__()
if not stride:
stride = 0
if stride is None:
stride = kernel_size
self.kernel_size = kernel_size
self.stride = stride
self.padding = padding

View File

@ -706,8 +706,8 @@ def max_unpool1d(x, indices, kernel_size, stride=None, padding=0, output_size=No
padding (Union[int, tuple[int]]): The pad value to be filled. Default: 0.
output_size (tuple[int], optional): The output shape. Default: None.
If output_size == (), then the shape of output computed by `kernel_size`, `stride` and `padding`.
If output_size != (), then output_size must be :math:`(N, C, H)` or
:math:`(C, H)` and output_size must belong to
If output_size != (), then output_size must be :math:`(N, C, H)` , :math:`(C, H)` or
:math:`(H)` and output_size must belong to
:math:`[(N, C, H_{out} - stride[0]), (N, C, H_{out} + stride[0])]`.
Returns:
@ -830,7 +830,8 @@ def max_unpool2d(x, indices, kernel_size, stride=None, padding=0, output_size=No
integers, the padding of height and width equal to padding[0] and padding[1] correspondingly.
output_size (tuple[int], optional): The target output size. Default: None.
If output_size == (), then the shape of output computed by `kernel_size`, `stride` and `padding`.
If output_size != (), then output_size must be :math:`(N, C, H, W)` and output_size must belong to
If output_size != (), then output_size must be :math:`(N, C, H, W)` , :math:`(C, H, W)` or :math:`(H, W)`
and output_size must belong to
:math:`[(N, C, H_{out} - stride[0], W_{out} - stride[1]),
(N, C, H_{out} + stride[0], W_{out} + stride[1])]`.
@ -937,7 +938,7 @@ def max_unpool3d(x, indices, kernel_size, stride=None, padding=0, output_size=No
correspondingly.
output_size (tuple[int], optional): The output size. Default: None. If output_size == (), then the shape of
output computed by `kernel_size`, `stride` and `padding`. If output_size != (), then output_size must be
:math:`(N, C, D, H, W)` or :math:`(C, D, H, W)` and output_size must belong to
:math:`(N, C, D, H, W)` or :math:`(C, D, H, W)` or :math:`(D, H, W)` and output_size must belong to
:math:`[(N, C, D_{out} - stride[0], H_{out} - stride[1], W_{out} - stride[2]),
(N, C, D_{out} + stride[0], H_{out} + stride[1], W_{out} + stride[2])]`.