1mindspore.ops.MaxPool3DWithArgmax 2================================= 3 4.. py:class:: mindspore.ops.MaxPool3DWithArgmax(ksize, strides, pads, dilation=(1, 1, 1), ceil_mode=False, data_format='NCDHW', argmax_type=mstype.int64) 5 6 三维最大值池化,返回最大值结果及其索引值。 7 8 输入是shape为 :math:`(N_{in}, C_{in}, D_{in}, H_{in}, W_{in})` 的Tensor,输出 :math:`(D_{in}, H_{in}, W_{in})` 维度中的最大值。给定 `ksize` 9 :math:`ks = (d_{ker}, h_{ker}, w_{ker})`,和 `strides` :math:`s = (s_0, s_1, s_2)`,运算如下: 10 11 .. math:: 12 \text{output}(N_i, C_j, d, h, w) = 13 \max_{l=0, \ldots, d_{ker}-1} \max_{m=0, \ldots, h_{ker}-1} \max_{n=0, \ldots, w_{ker}-1} 14 \text{input}(N_i, C_j, s_0 \times d + l, s_1 \times h + m, s_2 \times w + n) 15 16 输出是shape为 :math:`(N_{out}, C_{out}, D_{out}, H_{out}, W_{out})` 的Tensor,其深度、高度和宽度的计算公式如下: 17 18 .. math:: 19 \begin{array}{ll} \\ 20 D_{out} = \frac{D_{in} + 2 \times \text{pads}[0] - \text{dilation}[0] \times (\text{ksize}[0] - 1) - 1} 21 {\text{stride}[0]} + 1 \\ 22 H_{out} = \frac{H_{in} + 2 \times \text{pads}[1] - \text{dilation}[1] \times (\text{ksize}[1] - 1) - 1} 23 {\text{stride}[1]} + 1 \\ 24 W_{out} = \frac{W_{in} + 2 \times \text{pads}[2] - \text{dilation}[2] \times (\text{ksize}[2] - 1) - 1} 25 {\text{stride}[2]} + 1 \\ 26 \end{array} 27 28 .. warning:: 29 这是一个实验性API,后续可能修改或删除。 30 31 参数: 32 - **ksize** (Union[int, tuple[int]]) - 池化核尺寸大小。可以是一个整数表示池化核的深度,高度和宽度,或者包含三个整数的tuple,分别表示池化核的深度,高度和宽度。 33 - **strides** (Union[int, tuple[int]]) - 池化操作的移动步长。可以是一个整数表示在深度,高度和宽度方向的移动步长,或者包含三个整数的tuple,分别表示在深度,高度和宽度方向的移动步长。 34 - **pads** (Union[int, tuple[int]]) - 池化填充长度。可以是一个整数表示在深度,高度和宽度方向的填充长度,或者包含三个整数的tuple,分别表示在深度,高度和宽度方向的填充长度。 35 - **dilation** (Union[int, tuple[int]]) - 控制池化核内元素的间距。默认为 ``(1, 1, 1)`` 。 36 - **ceil_mode** (bool) - 是否使用ceil代替floor来计算输出的shape。默认为 ``False`` 。 37 - **data_format** (str) - 选择输入数据格式,当前仅支持 ``'NCDHW'`` 。默认为 ``'NCDHW'`` 。 38 - **argmax_type** (mindspore.dtype) - 返回的最大值索引的数据类型。默认为 ``mstype.int64`` 。 39 40 输入: 41 - **x** (Tensor) - shape为 :math:`(N_{in}, C_{in}, D_{in}, H_{in}, W_{in})` 的Tensor。支持数据类型包括int8、int16、int32、int64、uint8、uint16、uint32、uint64、float16、float32和float64。 42 43 输出: 44 包含两个Tensor的tuple,分别表示最大值结果和最大值对应的索引。 45 46 - **output** (Tensor) - 输出的池化后的最大值,shape为 :math:`(N_{out}, C_{out}, D_{out}, H_{out}, W_{out})` 。其数据类型与 `x` 相同。 47 - **argmax** (Tensor) - 输出的最大值对应的索引,数据类型为int32或者int64。 48 49 异常: 50 - **TypeError** - `x` 不是Tensor。 51 - **ValueError** - `x` 的维度不是5D。 52 - **TypeError** - `ksize` 、 `strides` 、 `pads` 、 `dilation` 不是int或者tuple。 53 - **ValueError** - `ksize` 或 `strides` 的元素值小于1。 54 - **ValueError** - `pads` 的元素值小于0。 55 - **ValueError** - `data_format` 不是 ``'NCDHW'`` 。 56 - **ValueError** - `argmax_type` 不是mstype.int64或mstype.int32。 57