o ( i @sddlmZddlmZddlmZddlmZddlm Z m Z ddl m Z m Z  ddddZ dd ddZGdddejZdS)!) annotationsN Convolution)UpSample) get_act_layerget_norm_layer)InterpolateMode UpsampleModeF spatial_dimsint in_channels out_channels kernel_sizestridebiasboolc Cst||||||ddS)NT)stridesrr conv_onlyr)r rrrrrrg/home/dell461/cl/sdc2/last_ska_mid/HISourceFinder-master-l/src/monai/networks/blocks/segresnet_block.pyget_conv_layersr nontrainable upsample_modeUpsampleMode | str scale_factorc Cst|||||tjddS)NF)r rrrmode interp_mode align_corners)rrLINEAR)r rrrrrrget_upsample_layersr"cs8eZdZdZddddiffdfdd ZddZZS)ResBlockz ResBlock employs skip connection and two convolution blocks and is used in SegResNet based on `3D MRI brain tumor segmentation using autoencoder regularization `_. r RELUinplaceTr r rnorm tuple | strractreturnNonecspt|ddkrtdt|||d|_t|||d|_t||_t||||d|_ t||||d|_ dS)a| Args: spatial_dims: number of spatial dimensions, could be 1, 2 or 3. in_channels: number of input channels. norm: feature normalization type and arguments. kernel_size: convolution kernel size, the value should be an odd number. Defaults to 3. act: activation type and arguments. Defaults to ``RELU``. rr z$kernel_size should be an odd number.)namer channels)rrrN) super__init__AssertionErrorrnorm1norm2rr(rconv1conv2)selfr rr&rr( __class__rrr.3s    zResBlock.__init__cCsL|}||}||}||}||}||}||}||7}|S)N)r0r(r2r1r3)r4xidentityrrrforwardSs      zResBlock.forward) r r rr r&r'rr r(r'r)r*)__name__ __module__ __qualname____doc__r.r9 __classcell__rrr5rr#,s   r#)r r F) r r rr rr rr rr rr)rr)r r rr rrrr ) __future__rtorch.nnnn"monai.networks.blocks.convolutionsrmonai.networks.blocks.upsamplermonai.networks.layers.utilsrr monai.utilsrr rr"Moduler#rrrrs