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

Method __init__

monai/networks/blocks/segresnet_block.py:51–81  ·  view source on GitHub ↗

Args: spatial_dims: number of spatial dimensions, could be 1, 2 or 3. in_channels: number of input channels. norm: feature normalization type and arguments. kernel_size: convolution kernel size, the value should be an odd number. Defaults to 3

(
        self,
        spatial_dims: int,
        in_channels: int,
        norm: tuple | str,
        kernel_size: int = 3,
        act: tuple | str = ("RELU", {"inplace": True}),
    )

Source from the content-addressed store, hash-verified

49 """
50
51 def __init__(
52 self,
53 spatial_dims: int,
54 in_channels: int,
55 norm: tuple | str,
56 kernel_size: int = 3,
57 act: tuple | str = ("RELU", {"inplace": True}),
58 ) -> None:
59 """
60 Args:
61 spatial_dims: number of spatial dimensions, could be 1, 2 or 3.
62 in_channels: number of input channels.
63 norm: feature normalization type and arguments.
64 kernel_size: convolution kernel size, the value should be an odd number. Defaults to 3.
65 act: activation type and arguments. Defaults to ``RELU``.
66 """
67
68 super().__init__()
69
70 if kernel_size % 2 != 1:
71 raise AssertionError("kernel_size should be an odd number.")
72
73 self.norm1 = get_norm_layer(name=norm, spatial_dims=spatial_dims, channels=in_channels)
74 self.norm2 = get_norm_layer(name=norm, spatial_dims=spatial_dims, channels=in_channels)
75 self.act = get_act_layer(act)
76 self.conv1 = get_conv_layer(
77 spatial_dims, in_channels=in_channels, out_channels=in_channels, kernel_size=kernel_size
78 )
79 self.conv2 = get_conv_layer(
80 spatial_dims, in_channels=in_channels, out_channels=in_channels, kernel_size=kernel_size
81 )
82
83 def forward(self, x):
84 identity = x

Callers

nothing calls this directly

Calls 3

get_norm_layerFunction · 0.90
get_act_layerFunction · 0.90
get_conv_layerFunction · 0.70

Tested by

no test coverage detected