
    {-jC                        d dl mZ d dlmZ d dlmZ ddlmZ erd dl	m
Z
 d dlmZmZmZ d dlmZ  G d	 d
e          ZdS )    )annotations)TYPE_CHECKING)Layer   )
functional)Tensor)DataLayout3DSize3Size6)_PaddingSizeModec                       e Zd ZU dZded<   ded<   ded<   ded	<   ded
<   ded<   ded<   	 	 	 	 	 	 dd fdZddZddZ xZS )	MaxPool3Da  
    This operation applies 3D max pooling over input features based on the sparse input,
    and kernel_size, stride, padding parameters. Input(X) and Output(Out) are
    in NDHWC format, where N is batch size, C is the number of channels,
    H is the height of the feature,  D is the depth of the feature, and W is the width of the feature.

    Parameters:
        kernel_size(int|list|tuple): The pool kernel size. If the kernel size
            is a tuple or list, it must contain three integers,
            (kernel_size_Depth, kernel_size_Height, kernel_size_Width).
            Otherwise, the pool kernel size will be the cube of an int.
        stride(int|list|tuple, optional): The pool stride size. If pool stride size is a tuple or list,
            it must contain three integers, [stride_Depth, stride_Height, stride_Width).
            Otherwise, the pool stride size will be a cube of an int.
            Default None, then stride will be equal to the kernel_size.
        padding(str|int|list|tuple, optional): The padding size. Padding could be in one of the following forms.
            1. A string in ['valid', 'same'].
            2. An int, which means the feature map is zero padded by size of `padding` on every sides.
            3. A list[int] or tuple(int) whose length is 3, [pad_depth, pad_height, pad_weight] whose value means the padding size of each dimension.
            4. A list[int] or tuple(int) whose length is . [pad_depth_front, pad_depth_back, pad_height_top, pad_height_bottom, pad_width_left, pad_width_right] whose value means the padding size of each side.
            5. A list or tuple of pairs of integers. It has the form [[pad_before, pad_after], [pad_before, pad_after], ...]. Note that, the batch dimension and channel dimension should be [0,0] or (0,0).
            The default value is 0.
        ceil_mode(bool, optional): ${ceil_mode_comment}
        return_mask(bool, optional): Whether to return the max indices along with the outputs.
        data_format(str, optional): The data format of the input and output data. An optional string from: `"NCDHW"`,
            `"NDHWC"`. The default is `"NCDHW"`. When it is `"NCDHW"`, the data is stored in the order of:
            `[batch_size, input_channels, input_depth, input_height, input_width]`. Currently, only support "NDHWC".
        name(str, optional): For detailed information, please refer to :ref:`api_guide_Name`.
            Usually name is no need to set and None by default.


    Returns:
        A callable object of MaxPool3D.

    Shape:
        - x(Tensor): The input SparseCooTensor of max pool3d operator, which is a 5-D tensor.
          The data type can be float32, float64.
        - output(Tensor): The output tensor of max pool3d  operator, which is a 5-D tensor.
          The data type is same as input x.

    Examples:
        .. code-block:: pycon

            >>> import paddle

            >>> dense_x = paddle.randn((2, 3, 6, 6, 3))
            >>> sparse_x = dense_x.to_sparse_coo(4)
            >>> max_pool3d = paddle.sparse.nn.MaxPool3D(kernel_size=3, data_format='NDHWC')
            >>> out = max_pool3d(sparse_x)
            >>> print(out.shape)
            paddle.Size([2, 1, 2, 2, 3])
    r
   kernel_sizeSize3 | Nonestride _PaddingSizeMode | Size3 | Size6paddingboolreturn_mask	ceil_moder	   data_format
str | NonenameNr   FNDHWCreturnNonec                    t                                                       || _        || _        || _        || _        || _        || _        || _        d S )N)	super__init__ksizer   r   r   r   r   r   )	selfr   r   r   r   r   r   r   	__class__s	           ^/var/www/html/banglarbhumi/venv/lib/python3.11/site-packages/paddle/sparse/nn/layer/pooling.pyr   zMaxPool3D.__init___   sR     	 
&"&			    xr   c           	     t    t          j        || j        | j        | j        | j        | j        | j                  S )N)r   r   r   r   r   r   )F
max_pool3dr    r   r   r   r   r   )r!   r%   s     r#   forwardzMaxPool3D.forwardr   s=    |
;Ln(
 
 
 	
r$   strc                &     dj         di | j        S )Nz7kernel_size={ksize}, stride={stride}, padding={padding} )format__dict__)r!   s    r#   
extra_reprzMaxPool3D.extra_repr}   s)    OHO 
 
m
 
 	
r$   )Nr   FFr   N)r   r
   r   r   r   r   r   r   r   r   r   r	   r   r   r   r   )r%   r   r   r   )r   r*   )	__name__
__module____qualname____doc____annotations__r   r)   r/   __classcell__)r"   s   @r#   r   r   !   s         3 3j ----OOO
  $45!$+      &	
 	
 	
 	

 
 
 
 
 
 
 
r$   r   N)
__future__r   typingr   	paddle.nnr    r   r'   paddler   paddle._typingr	   r
   r   paddle.nn.functional.commonr   r   r,   r$   r#   <module>r=      s    # " " " " "                         =         
 =<<<<<_
 _
 _
 _
 _
 _
 _
 _
 _
 _
r$   