two convolutions.
| 24 | |
| 25 | |
| 26 | class TwoConv(nn.Sequential): |
| 27 | """two convolutions.""" |
| 28 | |
| 29 | def __init__( |
| 30 | self, |
| 31 | spatial_dims: int, |
| 32 | in_chns: int, |
| 33 | out_chns: int, |
| 34 | act: str | tuple, |
| 35 | norm: str | tuple, |
| 36 | bias: bool, |
| 37 | dropout: float | tuple = 0.0, |
| 38 | ): |
| 39 | """ |
| 40 | Args: |
| 41 | spatial_dims: number of spatial dimensions. |
| 42 | in_chns: number of input channels. |
| 43 | out_chns: number of output channels. |
| 44 | act: activation type and arguments. |
| 45 | norm: feature normalization type and arguments. |
| 46 | bias: whether to have a bias term in convolution blocks. |
| 47 | dropout: dropout ratio. Defaults to no dropout. |
| 48 | |
| 49 | """ |
| 50 | super().__init__() |
| 51 | |
| 52 | conv_0 = Convolution(spatial_dims, in_chns, out_chns, act=act, norm=norm, dropout=dropout, bias=bias, padding=1) |
| 53 | conv_1 = Convolution( |
| 54 | spatial_dims, out_chns, out_chns, act=act, norm=norm, dropout=dropout, bias=bias, padding=1 |
| 55 | ) |
| 56 | self.add_module("conv_0", conv_0) |
| 57 | self.add_module("conv_1", conv_1) |
| 58 | |
| 59 | |
| 60 | class Down(nn.Sequential): |