o ) i@sfddlmZddlmZddlZddlmZddlmZddl m Z ddl m Z Gdddej ZdS) ) annotations)SequenceN) Convolution same_padding)Convcs8eZdZdZ     ddfdd ZdddZZS) SimpleASPPa A simplified version of the atrous spatial pyramid pooling (ASPP) module. Chen et al., Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. https://arxiv.org/abs/1802.02611 Wang et al., A Noise-robust Framework for Automatic Segmentation of COVID-19 Pneumonia Lesions from CT Images. https://ieeexplore.ieee.org/document/9109297 r r r BATCH LEAKYRELUF spatial_dimsint in_channelsconv_out_channels kernel_sizes Sequence[int] dilations norm_typetuple | str | None acti_typebiasboolreturnNonec  stt|t|krtdt|dt|dtddt||D} t|_t||| D]\} } } t t j |f||| | | d} |j | q3|t| }t |||d|||d|_ d S) a Args: spatial_dims: number of spatial dimensions, could be 1, 2, or 3. in_channels: number of input channels. conv_out_channels: number of output channels of each atrous conv. The final number of output channels is conv_out_channels * len(kernel_sizes). kernel_sizes: a sequence of four convolutional kernel sizes. Defaults to (1, 3, 3, 3) for four (dilated) convolutions. dilations: a sequence of four convolutional dilation parameters. Defaults to (1, 2, 4, 6) for four (dilated) convolutions. norm_type: final kernel-size-one convolution normalization type. Defaults to batch norm. acti_type: final kernel-size-one convolution activation type. Defaults to leaky ReLU. bias: whether to have a bias term in convolution blocks. Defaults to False. According to `Performance Tuning Guide `_, if a conv layer is directly followed by a batch norm layer, bias should be False. Raises: ValueError: When ``kernel_sizes`` length differs from ``dilations``. See also: :py:class:`monai.networks.layers.Act` :py:class:`monai.networks.layers.Conv` :py:class:`monai.networks.layers.Norm` z?kernel_sizes and dilations length must match, got kernel_sizes=z dilations=.css|] \}}t||VqdS)Nr).0kdr$\/home/dell461/cl/sdc2/last_ska_mid/HISourceFinder-master-l/src/monai/networks/blocks/aspp.py Psz&SimpleASPP.__init__..)r out_channels kernel_sizedilationpaddingr )rrr'r(actnormrN)super__init__len ValueErrortuplezipnn ModuleListconvsrCONVappendrconv_k1)selfrrrrrrrrZpadsr"r#pZ_convr' __class__r$r%r.#s4 '     zSimpleASPP.__init__x torch.Tensorcs,tjfdd|jDdd}||}|S)z^ Args: x: in shape (batch, channel, spatial_1[, spatial_2, ...]). csg|]}|qSr$r$)r!convr=r$r% isz&SimpleASPP.forward..r )dim)torchcatr5r8)r9r=x_outr$r@r%forwardds zSimpleASPP.forward)r r rrF)rrrrrrrrrrrrrrrrrr)r=r>rr>)__name__ __module__ __qualname____doc__r.rF __classcell__r$r$r;r%rsAr) __future__rcollections.abcrrCtorch.nnr3Z"monai.networks.blocks.convolutionsrmonai.networks.layersrmonai.networks.layers.factoriesrModulerr$r$r$r%s