parameters: (x,
                   indices,
                   kernel_size,
                   stride=None,
                   padding=0,
                   data_format="NCHW",
                   output_size=None,
                   name=None)
return_statement: return unpool_out
docstring: This API implements max unpooling 2d opereation.
      See more details in :ref:`api_nn_pooling_MaxUnPool2D` .
  
  
      Args:
          x (Tensor): The input tensor of unpooling operator which is a 4-D tensor with
                            shape [N, C, H, W]. The format of input tensor is `"NCHW"`, 
                            where `N` is batch size, `C` is the number of channels,
                            `H` is the height of the feature, and `W` is the width of the
                            feature. The data type if float32 or float64.
          indices (Tensor): The indices given out by maxpooling2d which is a 4-D tensor with
                            shape [N, C, H, W]. The format of input tensor is `"NCHW"` , 
                            where `N` is batch size, `C` is the number of channels,
                            `H` is the height of the feature, and `W` is the width of the
                            feature. The data type if float32 or float64.
          kernel_size (int|list|tuple): The unpool kernel size. If unpool kernel size is a tuple or list,
              it must contain an integer.
          stride (int|list|tuple): The unpool stride size. If unpool stride size is a tuple or list,
              it must contain an integer.
          kernel_size (int|tuple): Size of the max unpooling window.
          padding (int | tuple): Padding that was added to the input.
          output_size(list|tuple, optional): The target output size. If output_size is not specified, 
                             the actual output shape will be automatically calculated by (input_shape,
                             kernel_size, padding).
          name(str, optional): For detailed information, please refer
                               to :ref:`api_guide_Name`. Usually name is no need to set and
                               None by default.
  
  
          - Input: :math:`(N, C, H_{in}, W_{in})`
          - Output: :math:`(N, C, H_{out}, W_{out})`, where
  
            .. math::
              H_{out} = (H_{in} - 1) \times \text{stride[0]} - 2 \times \text{padding[0]} + \text{kernel\_size[0]}
  
            .. math::
              W_{out} = (W_{in} - 1) \times \text{stride[1]} - 2 \times \text{padding[1]} + \text{kernel\_size[1]}
  
            or as given by :attr:`output_size` in the call operator
  
          Returns:
              Tensor: The output tensor of unpooling result. 
  
          Raises:
              ValueError: If the input is not a 4-D tensor.
              ValueError: If indeces shape is not equal input shape.
              
  
          Examples:
              .. code-block:: python
            
              import paddle
              import paddle.nn.functional as F
  
              data = paddle.rand(shape=[1,1,6,6])
              pool_out, indices = F.max_pool2d(data, kernel_size=2, stride=2, padding=0, return_mask=True)
              # pool_out shape: [1, 1, 3, 3],  indices shape: [1, 1, 3, 3]
              unpool_out = F.max_unpool2d(pool_out, indices, kernel_size=2, padding=0)
              # unpool_out shape: [1, 1, 6, 6]
  
              # specify a different output size than input size 
              unpool_out = F.max_unpool2d(pool_out, indices, kernel_size=2, padding=0, output_size=[7,7])
              # unpool_out shape: [1, 1, 7, 7]
docstring_summary: This API implements max unpooling 2d opereation.
      See more details in :ref:`api_nn_pooling_MaxUnPool2D` .
docstring_tokens: This API implements max unpooling 2d opereation . See more details in : ref : api_nn_pooling_MaxUnPool2D .
function: def max_unpool2d(x,
                   indices,
                   kernel_size,
                   stride=None,
                   padding=0,
                   data_format="NCHW",
                   output_size=None,
                   name=None):
      """
      This API implements max unpooling 2d opereation.
      See more details in :ref:`api_nn_pooling_MaxUnPool2D` .
  
  
      Args:
          x (Tensor): The input tensor of unpooling operator which is a 4-D tensor with
                            shape [N, C, H, W]. The format of input tensor is `"NCHW"`, 
                            where `N` is batch size, `C` is the number of channels,
                            `H` is the height of the feature, and `W` is the width of the
                            feature. The data type if float32 or float64.
          indices (Tensor): The indices given out by maxpooling2d which is a 4-D tensor with
                            shape [N, C, H, W]. The format of input tensor is `"NCHW"` , 
                            where `N` is batch size, `C` is the number of channels,
                            `H` is the height of the feature, and `W` is the width of the
                            feature. The data type if float32 or float64.
          kernel_size (int|list|tuple): The unpool kernel size. If unpool kernel size is a tuple or list,
              it must contain an integer.
          stride (int|list|tuple): The unpool stride size. If unpool stride size is a tuple or list,
              it must contain an integer.
          kernel_size (int|tuple): Size of the max unpooling window.
          padding (int | tuple): Padding that was added to the input.
          output_size(list|tuple, optional): The target output size. If output_size is not specified, 
                             the actual output shape will be automatically calculated by (input_shape,
                             kernel_size, padding).
          name(str, optional): For detailed information, please refer
                               to :ref:`api_guide_Name`. Usually name is no need to set and
                               None by default.
  
  
          - Input: :math:`(N, C, H_{in}, W_{in})`
          - Output: :math:`(N, C, H_{out}, W_{out})`, where
  
            .. math::
              H_{out} = (H_{in} - 1) \times \text{stride[0]} - 2 \times \text{padding[0]} + \text{kernel\_size[0]}
  
            .. math::
              W_{out} = (W_{in} - 1) \times \text{stride[1]} - 2 \times \text{padding[1]} + \text{kernel\_size[1]}
  
            or as given by :attr:`output_size` in the call operator
  
          Returns:
              Tensor: The output tensor of unpooling result. 
  
          Raises:
              ValueError: If the input is not a 4-D tensor.
              ValueError: If indeces shape is not equal input shape.
              
  
          Examples:
              .. code-block:: python
            
              import paddle
              import paddle.nn.functional as F
  
              data = paddle.rand(shape=[1,1,6,6])
              pool_out, indices = F.max_pool2d(data, kernel_size=2, stride=2, padding=0, return_mask=True)
              # pool_out shape: [1, 1, 3, 3],  indices shape: [1, 1, 3, 3]
              unpool_out = F.max_unpool2d(pool_out, indices, kernel_size=2, padding=0)
              # unpool_out shape: [1, 1, 6, 6]
  
              # specify a different output size than input size 
              unpool_out = F.max_unpool2d(pool_out, indices, kernel_size=2, padding=0, output_size=[7,7])
              # unpool_out shape: [1, 1, 7, 7] 
  
      """
      kernel_size = utils.convert_to_list(kernel_size, 2, 'pool_size')
      if stride is None:
          stride = kernel_size
      else:
          stride = utils.convert_to_list(stride, 2, 'pool_stride')
      padding = utils.convert_to_list(padding, 2, 'padding')
  
      if data_format not in ["NCHW"]:
          raise ValueError("Attr(data_format) should be 'NCHW'. Received "
                           "Attr(data_format): %s." % str(data_format))
  
      output_size = _unpool_output_size(x, kernel_size, stride, padding,
                                        output_size)
  
      if in_dygraph_mode():
          output = _C_ops.unpool(x, indices, 'unpooling_type', 'max', 'ksize',
                                 kernel_size, 'strides', stride, 'paddings',
                                 padding, "output_size", output_size,
                                 "data_format", data_format)
          return output
  
      op_type = "unpool"
      helper = LayerHelper(op_type, **locals())
      dtype = helper.input_dtype(input_param_name="x")
      unpool_out = helper.create_variable_for_type_inference(dtype)
  
      helper.append_op(
          type=op_type,
          inputs={"X": x,
                  "Indices": indices},
          outputs={"Out": unpool_out},
          attrs={
              "unpooling_type": "max",
              "ksize": kernel_size,
              "strides": stride,
              "paddings": padding,
              "output_size": output_size
          })
      return unpool_out
function_tokens: def max_unpool2d ( x , indices , kernel_size , stride = None , padding = 0 , data_format = "NCHW" , output_size = None , name = None ) : kernel_size = utils . convert_to_list ( kernel_size , 2 , 'pool_size' ) if stride is None : stride = kernel_size else : stride = utils . convert_to_list ( stride , 2 , 'pool_stride' ) padding = utils . convert_to_list ( padding , 2 , 'padding' ) if data_format not in [ "NCHW" ] : raise ValueError ( "Attr(data_format) should be 'NCHW'. Received " "Attr(data_format): %s." % str ( data_format ) ) output_size = _unpool_output_size ( x , kernel_size , stride , padding , output_size ) if in_dygraph_mode ( ) : output = _C_ops . unpool ( x , indices , 'unpooling_type' , 'max' , 'ksize' , kernel_size , 'strides' , stride , 'paddings' , padding , "output_size" , output_size , "data_format" , data_format ) return output op_type = "unpool" helper = LayerHelper ( op_type , * * locals ( ) ) dtype = helper . input_dtype ( input_param_name = "x" ) unpool_out = helper . create_variable_for_type_inference ( dtype ) helper . append_op ( type = op_type , inputs = { "X" : x , "Indices" : indices } , outputs = { "Out" : unpool_out } , attrs = { "unpooling_type" : "max" , "ksize" : kernel_size , "strides" : stride , "paddings" : padding , "output_size" : output_size } ) return unpool_out