MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / _get_encode_layer

Method _get_encode_layer

monai/networks/nets/autoencoder.py:223–257  ·  view source on GitHub ↗

Returns a single layer of the encoder part of the network.

(self, in_channels: int, out_channels: int, strides: int, is_last: bool)

Source from the content-addressed store, hash-verified

221 return decode, layer_channels
222
223 def _get_encode_layer(self, in_channels: int, out_channels: int, strides: int, is_last: bool) -> nn.Module:
224 """
225 Returns a single layer of the encoder part of the network.
226 """
227 mod: nn.Module
228 if self.num_res_units > 0:
229 mod = ResidualUnit(
230 spatial_dims=self.dimensions,
231 in_channels=in_channels,
232 out_channels=out_channels,
233 strides=strides,
234 kernel_size=self.kernel_size,
235 subunits=self.num_res_units,
236 act=self.act,
237 norm=self.norm,
238 dropout=self.dropout,
239 bias=self.bias,
240 padding=self.padding,
241 last_conv_only=is_last,
242 )
243 return mod
244 mod = Convolution(
245 spatial_dims=self.dimensions,
246 in_channels=in_channels,
247 out_channels=out_channels,
248 strides=strides,
249 kernel_size=self.kernel_size,
250 act=self.act,
251 norm=self.norm,
252 dropout=self.dropout,
253 bias=self.bias,
254 padding=self.padding,
255 conv_only=is_last,
256 )
257 return mod
258
259 def _get_decode_layer(self, in_channels: int, out_channels: int, strides: int, is_last: bool) -> nn.Sequential:
260 """

Callers 1

_get_encode_moduleMethod · 0.95

Calls 2

ResidualUnitClass · 0.90
ConvolutionClass · 0.90

Tested by

no test coverage detected