(self)
| 117 | return down_layers |
| 118 | |
| 119 | def _make_up_layers(self): |
| 120 | up_layers, up_samples = nn.ModuleList(), nn.ModuleList() |
| 121 | upsample_mode, blocks_up, spatial_dims, filters, norm = ( |
| 122 | self.upsample_mode, |
| 123 | self.blocks_up, |
| 124 | self.spatial_dims, |
| 125 | self.init_filters, |
| 126 | self.norm, |
| 127 | ) |
| 128 | n_up = len(blocks_up) |
| 129 | for i in range(n_up): |
| 130 | sample_in_channels = filters * 2 ** (n_up - i) |
| 131 | up_layers.append( |
| 132 | nn.Sequential( |
| 133 | *[ |
| 134 | ResBlock(spatial_dims, sample_in_channels // 2, norm=norm, act=self.act) |
| 135 | for _ in range(blocks_up[i]) |
| 136 | ] |
| 137 | ) |
| 138 | ) |
| 139 | up_samples.append( |
| 140 | nn.Sequential( |
| 141 | *[ |
| 142 | get_conv_layer(spatial_dims, sample_in_channels, sample_in_channels // 2, kernel_size=1), |
| 143 | get_upsample_layer(spatial_dims, sample_in_channels // 2, upsample_mode=upsample_mode), |
| 144 | ] |
| 145 | ) |
| 146 | ) |
| 147 | return up_layers, up_samples |
| 148 | |
| 149 | def _make_final_conv(self, out_channels: int): |
| 150 | return nn.Sequential( |
no test coverage detected