o ) i@sBddlmZddlmZddlmZmZmZGdddejZ dS)) annotationsN) get_act_layerget_dropout_layerget_norm_layercs2eZdZdZ       ddfdd ZZS)ADNa  Constructs a sequential module of optional activation (A), dropout (D), and normalization (N) layers with an arbitrary order:: -- (Norm) -- (Dropout) -- (Acti) -- Args: ordering: a string representing the ordering of activation, dropout, and normalization. Defaults to "NDA". in_channels: `C` from an expected input of size (N, C, H[, W, D]). act: activation type and arguments. Defaults to PReLU. norm: feature normalization type and arguments. Defaults to instance norm. norm_dim: determine the spatial dimensions of the normalization layer. defaults to `dropout_dim` if unspecified. dropout: dropout ratio. Defaults to no dropout. dropout_dim: determine the spatial dimensions of dropout. defaults to `norm_dim` if unspecified. - When dropout_dim = 1, randomly zeroes some of the elements for each channel. - When dropout_dim = 2, Randomly zeroes out entire channels (a channel is a 2D feature map). - When dropout_dim = 3, Randomly zeroes out entire channels (a channel is a 3D feature map). Examples:: # activation, group norm, dropout >>> norm_params = ("GROUP", {"num_groups": 1, "affine": False}) >>> ADN(norm=norm_params, in_channels=1, dropout_dim=1, dropout=0.8, ordering="AND") ADN( (A): ReLU() (N): GroupNorm(1, 1, eps=1e-05, affine=False) (D): Dropout(p=0.8, inplace=False) ) # LeakyReLU, dropout >>> act_params = ("leakyrelu", {"negative_slope": 0.1, "inplace": True}) >>> ADN(act=act_params, in_channels=1, dropout_dim=1, dropout=0.8, ordering="AD") ADN( (A): LeakyReLU(negative_slope=0.1, inplace=True) (D): Dropout(p=0.8, inplace=False) ) See also: :py:class:`monai.networks.layers.Dropout` :py:class:`monai.networks.layers.Act` :py:class:`monai.networks.layers.Norm` :py:class:`monai.networks.layers.split_args` NDANRELUorderingstr in_channels int | Noneacttuple | str | Nonenormnorm_dimdropouttuple | str | float | None dropout_dimreturnNonec stdddd}|dur&|dur|durtdt||p ||d|d<|dur0t||d<|durJ|dur@|dur@tdt||pE|d|d<|D]} | |vr_td|d | d || durm|| || qNdS) N)ADNz.norm_dim or dropout_dim needs to be specified.)name spatial_dimschannelsrr)rrrzordering must be a string of z, got z in it.)super__init__ ValueErrorrrrupper add_module) selfr r r rrrrop_dictitem __class__a/home/dell461/cl/sdc2/last_ska_mid/HISourceFinder-master-l/src/monai/networks/blocks/acti_norm.pyrEs&    z ADN.__init__)rNrNNNN)r r r r r rrrrr rrrr rr)__name__ __module__ __qualname____doc__r __classcell__r&r&r$r'rs3r) __future__rtorch.nnnnZmonai.networks.layers.utilsrrr Sequentialrr&r&r&r's