modify maxpool3d errors

This commit is contained in:
fengyihang 2022-10-26 19:44:35 +08:00
parent 8d04817a64
commit 8188357ab0
3 changed files with 23 additions and 17 deletions

View File

@ -18,9 +18,9 @@ mindspore.nn.AvgPool3d
\text{input}(N_i, C_j, s_0 \times d + l, s_1 \times h + m, s_2 \times w + n)
参数:
- **kernel_size** (Union[int, tuple[int]]) - 指定池化核尺寸大小。如果为int则同时代表池化核的深度高度和宽度。如果为tuple其值必须包含三个int分别表示池化核的深度高度和宽度。
- **stride** (Union[int, tuple[int]]) - 池化操作的移动步长。如果为int则同时代表池化核的深度高度和宽度方向上的移动步长。如果为tuple其值必须包含三个整数值分别表示池化核的深度高度和宽度方向上的移动步长。默认值None
- **padding** (Union(int, tuple[int])) - 需要填充的pad值默认值0。如果 `padding` 为整数则分别在头右都填充padding如果 `padding` 是一个六个整数的元组则分别在头右填充padding[0]padding[1]padding[2]padding[3]padding[4]padding[5]。
- **kernel_size** (Union[int, tuple[int]]) - 指定池化核尺寸大小。如果为int则同时代表池化核的深度高度和宽度。如果为tuple其值必须包含三个int分别表示池化核的深度高度和宽度。取值必须为正整数。
- **stride** (Union[int, tuple[int]]) - 池化操作的移动步长。如果为int则同时代表池化核的深度高度和宽度方向上的移动步长。如果为tuple其值必须包含三个整数值分别表示池化核的深度高度和宽度方向上的移动步长。取值必须为正整数。如果值为None则使用默认值 `kernel_size`
- **padding** (Union(int, tuple[int])) - 需要填充的pad值默认值0。取值不能为负数。如果 `padding` 为整数则分别在头右都填充padding如果 `padding` 是一个六个整数的元组则分别在头右填充padding[0]padding[1]padding[2]padding[3]padding[4]padding[5]。
- **ceil_mode** (bool) - 若为True使用ceil来计算输出shape。若为False使用floor来计算输出shape。默认值False。
- **count_include_pad** (bool) - 平均计算是否包括零填充。默认值True。
- **divisor_override** (int) - 如果被指定为非0参数该参数将会在平均计算中被用作除数否则将会使用 `kernel_size` 作为除数默认值None。

View File

@ -15,12 +15,12 @@ mindspore.nn.MaxPool3d
\text{input}(N_i, C_j, s_0 \times d + l, s_1 \times h + m, s_2 \times w + n)
参数:
- **kernel_size** (Union[int, tuple[int]]) - 指定池化核尺寸大小,如果为整数则代表池化核的深度高和宽。如果为tuple其值必须包含三个整数值分别表示池化核的深度高和宽。默认值1
- **stride** (Union[int, tuple[int]]) - 池化操作的移动步长,如果为整数则代表池化核的深度高和宽方向的移动步长。如果为tuple其值必须包含三个整数值分别表示池化核的深度高和宽的移动步长。默认值1
- **padding** (Union[int, tuple[int]]) - 池化填充长度。可以是一个整数表示在深度高度和宽度方向的填充长度或者包含三个整数的tuple分别表示在深度高度和宽度方向的填充长度。
- **kernel_size** (Union[int, tuple[int]]) - 指定池化核尺寸大小,如果为int则代表池化核的深度高和宽。如果为tuple其值必须包含三个整数值分别表示池化核的深度,高和宽。取值必须为正整数
- **stride** (Union[int, tuple[int]]) - 池化操作的移动步长,如果为int则代表池化核的深度高和宽方向的移动步长。如果为tuple其值必须包含三个整数值分别表示池化核的深度,高和宽的移动步长。取值必须为正整数。如果值为None则使用默认值 `kernel_size`
- **padding** (Union[int, tuple[int]]) - 池化填充长度。可以是一个整数表示在深度高度和宽度方向的填充长度或者包含三个整数的tuple分别表示在深度高度和宽度方向的填充长度。取值不能为负数。默认值0。
- **dilation** (Union[int, tuple[int]]) - 控制池化核内元素的间距。默认值1。
- **return_indices** (bool) - 若为True则返回一个包含两个Tensor的Tuple表示池化的计算结果以及生成max值的位置否则仅返回池化计算结果。
- **ceil_mode** (bool) - 若为True使用ceil来计算输出shape。若为False使用floor来计算输出shape。默认值False。
- **return_indices** (bool) - 若为True则返回一个包含两个Tensor的Tuple表示池化的计算结果以及生成max值的位置否则仅返回池化计算结果。默认值False。
- **ceil_mode** (bool) - 若为True使用ceil模式来计算输出shape。若为False使用floor模式来计算输出shape。默认值False。
输入:
- **x** (Tensor) - shape为 :math:`(N_{in}, C_{in}, D_{in}, H_{in}, W_{in})` 或者 :math:`(C_{in}, D_{in}, H_{in}, W_{in})` 的Tensor。数据类型必须为int8、 int16、 int32、 int64、 uint8、 uint16、 uint32、 uint64、 float16、 float32 或者 float64。

View File

@ -249,16 +249,18 @@ class MaxPool3d(Cell):
Args:
kernel_size (Union[int, tuple[int]]): The size of kernel used to take the maximum value,
is an int number that represents depth, height and width of the kernel, or a tuple
of three int numbers that represent depth, height and width respectively. Default: 1.
of three int numbers that represent depth, height and width respectively.
The value must be a positive integer.
stride (Union[int, tuple[int]]): The moving stride of pooling operation, an int number that represents
the moving stride of pooling kernel in the directions of depth, height and the width,
or a tuple of three int numbers that represent depth, height and width of movement respectively. Default: 1.
or a tuple of three int numbers that represent depth, height and width of movement respectively.
The value must be a positive integer. If the value is None, the default value `kernel_size` is used.
padding (Union[int, tuple[int]]): Pooling padding length. An int number that represents the depth,
height and width of movement are both stride, or a tuple of three int numbers that represent depth,
height and width of movement respectively.
height and width of movement respectively. The value cannot be negative. Default: 0.
dilation (Union[int, tuple[int]]): Control the spacing of elements in the pooling kernel. Default: 1.
return_indices (bool): If True, output is a Tuple of 2 Tensors, representing the maxpool result and where
the max values are generated. Otherwise, only the maxpool result is returned.
the max values are generated. Otherwise, only the maxpool result is returned. Default: False.
ceil_mode (bool): Whether to use ceil or floor to calculate output shape. Default: False.
Inputs:
@ -328,6 +330,7 @@ class MaxPool3d(Cell):
def __init__(self, kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False):
"""Initialize MaxPool3d."""
super(MaxPool3d, self).__init__()
stride = stride if (stride is not None) else kernel_size
self.return_indices = return_indices
self.max_pool = MaxPool3DWithArgmax(kernel_size, stride, padding, dilation, ceil_mode)
self.expand_dims = P.ExpandDims()
@ -523,13 +526,16 @@ class AvgPool3d(Cell):
kernel_size (Union[int, tuple[int]]): The size of kernel used to take the average value,
is an int number that represents depth, height and width are both kernel_size, or a tuple
of three int numbers that represent depth, height and width respectively.
The value must be a positive integer.
stride (Union[int, tuple[int]]): The distance of kernel moving, an int number that represents
the depth, height and width of movement are both stride, or a tuple of three int numbers that
represent depth, height and width of movement respectively. Default: None.
padding (Union(int, tuple[int])): The padding value to be filled. Default: 0. If `padding` is an integer,
the paddings of head, tail, top, bottom, left and right are the same, equal to padding.
If `padding` is a tuple of six integers, the padding of head, tail, top, bottom, left and right
equal to padding[0], padding[1], padding[2], padding[3], padding[4] and padding[5] correspondingly.
represent depth, height and width of movement respectively. The value must be a positive integer.
If the value is None, the default value `kernel_size` is used.
padding (Union(int, tuple[int])): The padding value to be filled. Default: 0. The value cannot be negative.
If `padding` is an integer, the paddings of head, tail, top, bottom, left and right are the same,
equal to padding.
If `padding` is a tuple of six integers, the padding of head, tail, top, bottom, left and right
equal to padding[0], padding[1], padding[2], padding[3], padding[4] and padding[5] correspondingly.
ceil_mode (bool): If True, use ceil to compute the output shape instead of floor. Default: False.
count_include_pad (bool): If True, averaging calculation will include the zero-padding. Default: True.
divisor_override (int): If specified, it will be used as divisor in the averaging calculation,