Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

PR

Just a small problem.

I can fix it online!

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.ops.MaxPool3DWithArgmax

View Source On Gitee
class mindspore.ops.MaxPool3DWithArgmax(ksize, strides, pads, dilation=(1, 1, 1), ceil_mode=False, data_format='NCDHW', argmax_type=mstype.int64)[source]

Performs a 3D max pooling on the input Tensor and returns both max values and indices.

Typically the input is a Tensor with shape (Nin,Cin,Din,Hin,Win), outputs regional maximum in the (Din,Hin,Win)-dimension. Given ksize ks=(dker,hker,wker) and strides s=(s0,s1,s2), the operation is as follows.

output(Ni,Cj,d,h,w)=maxl=0,,dker1maxm=0,,hker1maxn=0,,wker1input(Ni,Cj,s0×d+l,s1×h+m,s2×w+n)

The output is a Tensor with shape (Nout,Cout,Dout,Hout,Wout) and its depth, height and width are:

Dout=Din+2×pads[0]dilation[0]×(ksize[0]1)1stride[0]+1Hout=Hin+2×pads[1]dilation[1]×(ksize[1]1)1stride[1]+1Wout=Win+2×pads[2]dilation[2]×(ksize[2]1)1stride[2]+1

Warning

This is an experimental API that is subject to change or deletion.

Parameters
  • ksize (Union[int, tuple[int]]) – The size of kernel used to take the maximum value and arg 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.

  • strides (Union[int, tuple[int]]) – The distance of kernel moving, an int number that represents the depth, height and width of movement are both strides, or a tuple of three int numbers that represent depth, height and width of movement respectively.

  • pads (Union[int, tuple[int]]) – An int number that represents the depth, height and width of movement are both strides, or a tuple of three int numbers that represent depth, height and width of movement respectively.

  • dilation (Union[int, tuple[int]]) – Default: (1, 1, 1) .

  • ceil_mode (bool) – Whether to use ceil instead of floor to calculate output shape. Default: False .

  • data_format (str) – The optional value for data format. Currently only support 'NCDHW' . Default: 'NCDHW' .

  • argmax_type (mindspore.dtype) – The dtype for argmax. Default: mstype.int64 .

Inputs:
  • x (Tensor) - Tensor of shape (Nin,Cin,Din,Hin,Win) with data type of int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32 or float64.

Outputs:

Tuple of 2 Tensors, representing the maxpool result and where the max values are generated.

  • output (Tensor) - Maxpooling result, with shape (Nout,Cout,Dout,Hout,Wout). It has the same data type as x.

  • argmax (Tensor) - Index corresponding to the maximum value. Data type is int32 or int64.

Raises
  • TypeError – If x is not a Tensor.

  • ValueError – If length of shape of x is not equal to 5.

  • TypeError – If ksize , strides , pads or dilation is not int or tuple.

  • ValueError – If ksize or strides is less than 1.

  • ValueError – If pads is less than 0.

  • ValueError – If data_format is not 'NCDHW'.

  • ValueError – If argmax_type is not mindspore.int64 or mindspore.int32.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> x = Tensor(np.arange(2 * 1 * 2 * 2 * 2).reshape((2, 1, 2, 2, 2)), mindspore.float32)
>>> max_pool3d_with_arg_op = ops.MaxPool3DWithArgmax(ksize=2, strides=1, pads=1)
>>> output_tensor, argmax = max_pool3d_with_arg_op(x)
>>> print(output_tensor.shape)
(2, 1, 3, 3, 3)
>>> print(argmax.shape)
(2, 1, 3, 3, 3)