mindspore.ops.MaxUnpool3D
- class mindspore.ops.MaxUnpool3D(ksize, strides=0, pads=0, output_shape=(), data_format='NCDHW')[source]
Computes the inverse of
mindspore.ops.MaxPool3D
.MaxUnpool3D keeps the maximal value and set all position of non-maximal values to zero. Typically the input is of shape
, the output is of shape , the operation is as follows.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, 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]], optional) –
The distance of kernel moving. Default:
0
.If it is an int number, the depth, height and width of movement are all equal to strides.
If it is a tuple of three int numbers, they represent depth, height and width of movement respectively.
If strides is 0 or (0, 0, 0), then strides equal to ksize.
pads (Union[int, tuple[int]], optional) –
The pad value to be filled. Default:
0
.If pads is an integer, the paddings of depth, height and width are the same, equal to pads.
If pads is a tuple of three integers, the padding of depth, height and width equal to pads[0], pads[1] and pads[2] correspondingly.
output_shape (tuple[int], optional) – The target output size. Default:
()
. If , then the shape of output computed by kszie, strides and pads shown above. If , then output_shape format must be or and output_shape must be in range .data_format (str, optional) – The optional value for data format. Currently support
'NCDHW'
and'NDHWC'
. Default:'NCDHW'
.
- Inputs:
x (Tensor) - The input Tensor to invert. Tensor of shape
or .argmax (Tensor) - Max values' index. Tensor that has the same shape as x. Values of argmax must be in range
. Data type must be int32 or int64.
- Outputs:
Tensor, with shape
or . Has the same data type with x.
- Raises
TypeError – If data type of x or argmax is Number.
TypeError – If ksize, strides or pads is neither int nor tuple.
ValueError – If numbers in strides or ksize is negative.
ValueError – If numbers in pads is negative.
ValueError – If ksize, strides or pads is a tuple whose length is not equal to 3.
ValueError – If data_format is not a str or is neither
'NCDHW'
nor'NDHWC'
.ValueError – If output_shape whose length is neither 0 or 5.
ValueError – If output_shape is not close to output size range computed by attr ksize, strides, pads.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import numpy as np >>> from mindspore import Tensor, ops >>> x = Tensor(np.array([[[[[0, 1], [8, 9]]]]]).astype(np.float32)) >>> argmax = Tensor(np.array([[[[[0, 1], [2, 3]]]]]).astype(np.int64)) >>> maxunpool3d = ops.MaxUnpool3D(ksize=1, strides=1, pads=0) >>> output = maxunpool3d(x, argmax) >>> print(output.asnumpy()) [[[[[0. 1.] [8. 9.]]]]]