mindspore.ops.adaptive_max_pool3d

mindspore.ops.adaptive_max_pool3d(x, output_size, return_indices=False)[source]

Applies a 3D adaptive max pooling over an input signal composed of several input planes.

The output is of size \((D, H, W)\), for any input size. The number of output features is equal to the number of input planes.

Parameters
  • x (Tensor) – Tensor, with shape \((C, D, H, W)\) or \((N, C, D, H, W)\), which support int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32 or float64 data type.

  • output_size (Union[int, tuple]) – The target output size. ouput_size can be a tuple \((D, H, W)\), or an int D for \((D, D, D)\). \(D\), \(H\) and \(W\) can be int or None which means the output size is the same as that of the input.

  • return_indices (bool, optional) – If return_indices is True, the indices of max value would be output, else would not be output. Default: False.

Returns

  • y (Tensor) - Tensor, with the same number of dims and data type as the x.

  • argmax (Tensor) - Tensor, the indices of max value, which has the same shape as the y and it’s data type is int32. It will output only when return_indices is True.

Raises
  • TypeError – If x is not a Tensor.

  • ValueError – If the dimensions number of x is not 4 or 5.

  • TypeError – If dtype of x is not int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32 or float64.

  • ValueError – If output_size is neither an int nor a tuple with shape (3,).

Supported Platforms:

GPU CPU

Examples

>>> x = Tensor(np.arange(0,36).reshape((1, 3, 3, 4)).astype(np.float32))
>>> output_size = (1, 1, 2)
>>> output = ops.adaptive_max_pool3d(x, output_size, True)
>>> print(output[0].asnumpy())
[[[[33. 35.]]]]
>>> print(output[1].asnumpy())
[[[[33 35]]]]