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.

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

class mindspore.ops.FractionalMaxPool(pooling_ratio, pseudo_random=False, overlapping=False, deterministic=False, seed=0, seed2=0)[source]

Performs fractional max pooling on the input.

Fractional max pooling is similar to regular max pooling, In regular max pooling, you downsize an input set by taking the maximum value of smaller N x N subsections of the set (often 2x2), and try to reduce the set by a factor of N, where N is an integer. Fractional max pooling, means that the overall reduction ratio N does not have to be an integer. The sizes of the pooling regions are generated randomly but are fairly uniform.

Warning

“pooling_ratio”, currently only supports row and col dimension and should be >= 1.0, the first and last elements must be 1.0 because we don’t allow pooling on batch and channels dimensions.

Parameters
  • pooling_ratio (list(float)) – Decide the shape of output, is a list of floats that has length >= 4. Pooling ratio for each dimension of value should be >=0, currently only support for row and col dimension. The first and last elements must be 1.0 because we don’t allow pooling on batch and channels dimensions.

  • pseudo_random (bool, optional) – When set to True, generates the pooling sequence in a pseudo random fashion, otherwise, in a random fashion. Check paper Benjamin Graham, Fractional Max-Pooling for difference between pseudo_random and random. Defaults to False.

  • overlapping (bool, optional) – When set to True, it means when pooling, the values at the boundary of adjacent pooling cells are used by both cells. When set to False, the values are not reused. Defaults to False.

  • deterministic (bool, optional) – When set to True, a fixed pooling region will be used when iterating over a FractionalMaxPool node in the computation graph. Mainly used in unit test to make FractionalMaxPool deterministic. When set to False, fixed pool regions will not be used. Defaults to False.

  • seed (int, optional) – If either seed or seed2 are set to be non-zero, the random number generator is seeded by the given seed. Otherwise, it is seeded by a random seed. Defaults to 0.

  • seed2 (int, optional) – An second seed to avoid seed collision. Defaults to 0.

Inputs:
  • x (Tensor) -The data type must be one of the following types: float32, float64, int32, int64. Tensor of shape (N,Hin,Win,Cin).

Outputs:
  • y (Tensor) - the output of FractionalMaxPool, has the same data type with x. Tensor of shape (N,Hout,Wout,Cout).

  • row_pooling_sequence (Tensor) - A tensor of type int64, the result list of pool boundary rows.

  • col_pooling_sequence (Tensor) - A tensor of type int64, the result list of pool boundary cols.

Raises
  • TypeError – If data type of x is not float32, float64, int32, int64.

  • TypeError – If x is not a 4D tensor.

  • ValueError – If element of x equals 0 or is less than 0.

  • ValueError – If pooling_ratio is a list whose length is not equal to 4.

  • ValueError – If the first and last element of pooling_ratio is not equal to 1.0.

Supported Platforms:

GPU CPU

Examples

>>> x = np.array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]).reshape([1,4,4,1]).astype(np.int64)
>>> pooling_ratio=[1.0,1.5,1.5,1.0]
>>> fractionalmaxpool_op = ops.FractionalMaxPool(pooling_ratio=pooling_ratio)
>>> output = fractionalmaxpool_op(Tensor(x))
>>> print(output)
(Tensor(shape=[1, 2, 2, 1], dtype=Int64, value=
[[[[ 6],
   [ 8]],
  [[14],
   [16]]]]), Tensor(shape=[3], dtype=Int64, value= [0, 2, 4]), Tensor(shape=[3], dtype=Int64, value= [0, 2, 4]))