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

Method __init__

monai/networks/nets/flexible_unet.py:191–216  ·  view source on GitHub ↗
(
        self,
        spatial_dims: int,
        in_channels: int,
        out_channels: int,
        kernel_size: int = 3,
        act: tuple | str | None = None,
        scale_factor: float = 1.0,
    )

Source from the content-addressed store, hash-verified

189 """
190
191 def __init__(
192 self,
193 spatial_dims: int,
194 in_channels: int,
195 out_channels: int,
196 kernel_size: int = 3,
197 act: tuple | str | None = None,
198 scale_factor: float = 1.0,
199 ):
200 conv_layer = Conv[Conv.CONV, spatial_dims](
201 in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, padding=kernel_size // 2
202 )
203 up_layer: nn.Module = nn.Identity()
204 if scale_factor > 1.0:
205 up_layer = UpSample(
206 spatial_dims=spatial_dims,
207 scale_factor=scale_factor,
208 mode="nontrainable",
209 pre_conv=None,
210 interp_mode=InterpolateMode.LINEAR,
211 )
212 if act is not None:
213 act_layer = get_act_layer(act)
214 else:
215 act_layer = nn.Identity()
216 super().__init__(conv_layer, up_layer, act_layer)
217
218
219class FlexibleUNet(nn.Module):

Callers

nothing calls this directly

Calls 3

UpSampleClass · 0.90
get_act_layerFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected