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

Method __init__

monai/networks/nets/segresnet_ds.py:75–118  ·  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. Defaults to 3. act: activation type

(
        self,
        spatial_dims: int,
        in_channels: int,
        norm: tuple | str,
        kernel_size: tuple | int = 3,
        act: tuple | str = "relu",
    )

Source from the content-addressed store, hash-verified

73 """
74
75 def __init__(
76 self,
77 spatial_dims: int,
78 in_channels: int,
79 norm: tuple | str,
80 kernel_size: tuple | int = 3,
81 act: tuple | str = "relu",
82 ) -> None:
83 """
84 Args:
85 spatial_dims: number of spatial dimensions, could be 1, 2 or 3.
86 in_channels: number of input channels.
87 norm: feature normalization type and arguments.
88 kernel_size: convolution kernel size. Defaults to 3.
89 act: activation type and arguments. Defaults to ``RELU``.
90 """
91 super().__init__()
92
93 if isinstance(kernel_size, (tuple, list)):
94 padding = tuple(k // 2 for k in kernel_size)
95 else:
96 padding = kernel_size // 2 # type: ignore
97
98 self.norm1 = get_norm_layer(name=norm, spatial_dims=spatial_dims, channels=in_channels)
99 self.act1 = get_act_layer(act)
100 self.conv1 = Conv[Conv.CONV, spatial_dims](
101 in_channels=in_channels,
102 out_channels=in_channels,
103 kernel_size=kernel_size,
104 stride=1,
105 padding=padding,
106 bias=False,
107 )
108
109 self.norm2 = get_norm_layer(name=norm, spatial_dims=spatial_dims, channels=in_channels)
110 self.act2 = get_act_layer(act)
111 self.conv2 = Conv[Conv.CONV, spatial_dims](
112 in_channels=in_channels,
113 out_channels=in_channels,
114 kernel_size=kernel_size,
115 stride=1,
116 padding=padding,
117 bias=False,
118 )
119
120 def forward(self, x):
121 identity = x

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 2

get_norm_layerFunction · 0.90
get_act_layerFunction · 0.90

Tested by

no test coverage detected