U
    Phm	                     @  sZ   d dl mZ d dlmZ d dlZd dlmZ d dlmZ d dl	m
Z
 G dd dejZdS )    )annotations)SequenceN)Pool)ensure_tuple_repc                      sB   e Zd ZdZddddddd	d
 fddZdddddZ  ZS )
MaxAvgPoolz
    Downsample with both maxpooling and avgpooling,
    double the channel size by concatenating the downsampled feature maps.
    Nr   FintzSequence[int] | intzSequence[int] | int | NoneboolNone)spatial_dimskernel_sizestridepadding	ceil_modereturnc                   sf   t    t|||dkrdnt||t|||d}ttj|f f || _ttj|f f || _dS )a  
        Args:
            spatial_dims: number of spatial dimensions of the input image.
            kernel_size: the kernel size of both pooling operations.
            stride: the stride of the window. Default value is `kernel_size`.
            padding: implicit zero padding to be added to both pooling operations.
            ceil_mode: when True, will use ceil instead of floor to compute the output shape.
        N)r   r   r   r   )super__init__r   r   MAXmax_poolAVGavg_pool)selfr
   r   r   r   r   _params	__class__ U/home/dell461/cl/sdc2/HISourceFinder-master-l/src/monai/networks/blocks/downsample.pyr      s    
zMaxAvgPool.__init__ztorch.Tensor)xr   c                 C  s   t j| || |gddS )z
        Args:
            x: Tensor in shape (batch, channel, spatial_1[, spatial_2, ...]).

        Returns:
            Tensor in shape (batch, 2*channel, spatial_1[, spatial_2, ...]).
           )dim)torchcatr   r   )r   r   r   r   r   forward7   s    zMaxAvgPool.forward)Nr   F)__name__
__module____qualname____doc__r   r!   __classcell__r   r   r   r   r      s   	   r   )
__future__r   collections.abcr   r   torch.nnnnmonai.networks.layers.factoriesr   monai.utilsr   Moduler   r   r   r   r   <module>   s   