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.FractionalMaxPool3DWithFixedKsize

View Source On Gitee
class mindspore.ops.FractionalMaxPool3DWithFixedKsize(ksize, output_shape, data_format='NCDHW')[source]

Applies a 3D fractional max pooling to an input signal composed of multiple input planes. The max-pooling operation is applied in (kD,kH,kW) regions by a stochastic step size determined by the target output size output_shape.

The number of output features is equal to the number of input planes.

Refer to the paper Fractional MaxPooling by Ben Graham for more details.

The input and output data format can be "NCDHW" and "NDHWC". N is the batch size, C is the number of channels, D the feature depth, H is the feature height, and W is the feature width.

Warning

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

Parameters
  • ksize (Union[float, tuple]) – Size of the pooling window. ksize can be a tuple of three values specify a shape (kD,kH,kW), or a single int K for (K,K,K).

  • output_shape (Union[int, tuple]) – The target output shape. output_shape can be a tuple of three values specify a shape (Dout,Hout,Wout), or a single float S for (S,S,S).

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

Inputs:
  • x (Tensor) - The input of FractionalMaxPool3DWithFixedKsize, which is a 4D or 5D tensor. Tensor of data type : float16, float32, double, int32, int64. Supported shape (N,C,Din,Hin,Win) or (N,Din,Hin,Win,C).

  • random_samples (Tensor) - The random step of FractionalMaxPool3DWithFixedKsize, which is a 3D tensor. Tensor of data type : float16, float32, double, and value is between (0, 1). Supported shape (N,C,3)

Outputs:
  • y (Tensor) - A tensor, the output of FractionalMaxPool3DWithFixedKsize. Has the same data type with x. Tensor of shape (N,C,Dout,Hout,Wout) or (N,Dout,Hout,Wout,C).

  • argmax (Tensor) - A tensor, the indices along with the outputs. Has the same shape as the y and int32 or int64 data type.

Raises
  • TypeError – If input_x is not a 4D or 5D tensor.

  • TypeError – If random_samples is not a 3D tensor.

  • TypeError – If data type of x is not float16, float32, double, int32, int64.

  • TypeError – If dtype of random_samples is not float16, float32, double.

  • TypeError – If dtype of argmax is not int32, int64.

  • ValueError – If output_shape is a tuple and if output_shape length is not 3.

  • ValueError – If ksize is a tuple and if ksize length is not 3.

  • ValueError – If numbers in output_shape or ksize is not positive.

  • ValueError – If data_format is neither 'NCDHW' nor 'NDHWC'.

  • ValueError – If the first dimension size of input_x and random_samples is not equal.

  • ValueError – If the second dimension size of input_x and random_samples is not equal.

  • ValueError – If the third dimension size of random_samples is not 3.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> from mindspore import dtype as mstype
>>> x = Tensor(np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
...       .reshape([1, 1, 2, 2, 4]), mstype.float32)
>>> random_samples = Tensor(np.array([0.7, 0.7, 0.7]).reshape([1, 1, 3]), mstype.float32)
>>> ksize = (1, 1, 1)
>>> output_shape = (1, 1, 2)
>>> net = ops.FractionalMaxPool3DWithFixedKsize(ksize = ksize, output_shape = output_shape)
>>> output, argmax = net(x, random_samples)
>>> print(output)
[[[[[13. 16.]]]]]
>>> print(argmax)
[[[[[12 15]]]]]