We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`HighResBlock` may have wrong conv block
The `Convolution` block in `HighResBlock` does not utilize acti and norm parameters thus will used default instance norm layer and prelu activation layer. However, it is different from all other `Convolution` blocks in `HighResNet`. Is is a mistake? @wyli 
`HighResBlock` may have wrong conv block
The `Convolution` block in `HighResBlock` does not utilize acti and norm parameters thus will used default instance norm layer and prelu activation layer. However, it is different from all other `Convolution` blocks in `HighResNet`. Is is a mistake? @wyli 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `monai/networks/nets/highresnet.py`
Content:
```
1 # Copyright 2020 - 2021 MONAI Consortium
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #     http://www.apache.org/licenses/LICENSE-2.0
6 # Unless required by applicable law or agreed to in writing, software
7 # distributed under the License is distributed on an "AS IS" BASIS,
8 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 # See the License for the specific language governing permissions and
10 # limitations under the License.
11 
12 from typing import Dict, Optional, Sequence, Tuple, Union
13 
14 import torch
15 import torch.nn as nn
16 
17 from monai.networks.blocks import ADN, Convolution
18 from monai.networks.layers.simplelayers import ChannelPad
19 from monai.utils import ChannelMatching
20 
21 __all__ = ["HighResBlock", "HighResNet"]
22 
23 DEFAULT_LAYER_PARAMS_3D = (
24     # initial conv layer
25     {"name": "conv_0", "n_features": 16, "kernel_size": 3},
26     # residual blocks
27     {"name": "res_1", "n_features": 16, "kernels": (3, 3), "repeat": 3},
28     {"name": "res_2", "n_features": 32, "kernels": (3, 3), "repeat": 3},
29     {"name": "res_3", "n_features": 64, "kernels": (3, 3), "repeat": 3},
30     # final conv layers
31     {"name": "conv_1", "n_features": 80, "kernel_size": 1},
32     {"name": "conv_2", "kernel_size": 1},
33 )
34 
35 
36 class HighResBlock(nn.Module):
37     def __init__(
38         self,
39         spatial_dims: int,
40         in_channels: int,
41         out_channels: int,
42         kernels: Sequence[int] = (3, 3),
43         dilation: Union[Sequence[int], int] = 1,
44         norm_type: Union[Tuple, str] = ("batch", {"affine": True}),
45         acti_type: Union[Tuple, str] = ("relu", {"inplace": True}),
46         bias: bool = False,
47         channel_matching: Union[ChannelMatching, str] = ChannelMatching.PAD,
48     ) -> None:
49         """
50         Args:
51             spatial_dims: number of spatial dimensions of the input image.
52             in_channels: number of input channels.
53             out_channels: number of output channels.
54             kernels: each integer k in `kernels` corresponds to a convolution layer with kernel size k.
55             dilation: spacing between kernel elements.
56             norm_type: feature normalization type and arguments.
57                 Defaults to ``("batch", {"affine": True})``.
58             acti_type: {``"relu"``, ``"prelu"``, ``"relu6"``}
59                 Non-linear activation using ReLU or PReLU. Defaults to ``"relu"``.
60             bias: whether to have a bias term in convolution blocks. Defaults to False.
61                 According to `Performance Tuning Guide <https://pytorch.org/tutorials/recipes/recipes/tuning_guide.html>`_,
62                 if a conv layer is directly followed by a batch norm layer, bias should be False.
63             channel_matching: {``"pad"``, ``"project"``}
64                 Specifies handling residual branch and conv branch channel mismatches. Defaults to ``"pad"``.
65 
66                 - ``"pad"``: with zero padding.
67                 - ``"project"``: with a trainable conv with kernel size one.
68 
69         Raises:
70             ValueError: When ``channel_matching=pad`` and ``in_channels > out_channels``. Incompatible values.
71 
72         """
73         super(HighResBlock, self).__init__()
74         self.chn_pad = ChannelPad(
75             spatial_dims=spatial_dims, in_channels=in_channels, out_channels=out_channels, mode=channel_matching
76         )
77 
78         layers = nn.ModuleList()
79         _in_chns, _out_chns = in_channels, out_channels
80 
81         for kernel_size in kernels:
82             layers.append(
83                 ADN(ordering="NA", in_channels=_in_chns, act=acti_type, norm=norm_type, norm_dim=spatial_dims)
84             )
85             layers.append(
86                 Convolution(
87                     dimensions=spatial_dims,
88                     in_channels=_in_chns,
89                     out_channels=_out_chns,
90                     kernel_size=kernel_size,
91                     dilation=dilation,
92                     bias=bias,
93                 )
94             )
95             _in_chns = _out_chns
96 
97         self.layers = nn.Sequential(*layers)
98 
99     def forward(self, x: torch.Tensor) -> torch.Tensor:
100         x_conv: torch.Tensor = self.layers(x)
101         return x_conv + torch.as_tensor(self.chn_pad(x))
102 
103 
104 class HighResNet(nn.Module):
105     """
106     Reimplementation of highres3dnet based on
107     Li et al., "On the compactness, efficiency, and representation of 3D
108     convolutional networks: Brain parcellation as a pretext task", IPMI '17
109 
110     Adapted from:
111     https://github.com/NifTK/NiftyNet/blob/v0.6.0/niftynet/network/highres3dnet.py
112     https://github.com/fepegar/highresnet
113 
114     Args:
115         spatial_dims: number of spatial dimensions of the input image.
116         in_channels: number of input channels.
117         out_channels: number of output channels.
118         norm_type: feature normalization type and arguments.
119             Defaults to ``("batch", {"affine": True})``.
120         acti_type: activation type and arguments.
121             Defaults to ``("relu", {"inplace": True})``.
122         dropout_prob: probability of the feature map to be zeroed
123             (only applies to the penultimate conv layer).
124         bias: whether to have a bias term in convolution blocks. Defaults to False.
125             According to `Performance Tuning Guide <https://pytorch.org/tutorials/recipes/recipes/tuning_guide.html>`_,
126             if a conv layer is directly followed by a batch norm layer, bias should be False.
127         layer_params: specifying key parameters of each layer/block.
128         channel_matching: {``"pad"``, ``"project"``}
129             Specifies handling residual branch and conv branch channel mismatches. Defaults to ``"pad"``.
130 
131             - ``"pad"``: with zero padding.
132             - ``"project"``: with a trainable conv with kernel size one.
133     """
134 
135     def __init__(
136         self,
137         spatial_dims: int = 3,
138         in_channels: int = 1,
139         out_channels: int = 1,
140         norm_type: Union[str, tuple] = ("batch", {"affine": True}),
141         acti_type: Union[str, tuple] = ("relu", {"inplace": True}),
142         dropout_prob: Optional[Union[Tuple, str, float]] = 0.0,
143         bias: bool = False,
144         layer_params: Sequence[Dict] = DEFAULT_LAYER_PARAMS_3D,
145         channel_matching: Union[ChannelMatching, str] = ChannelMatching.PAD,
146     ) -> None:
147 
148         super(HighResNet, self).__init__()
149         blocks = nn.ModuleList()
150 
151         # initial conv layer
152         params = layer_params[0]
153         _in_chns, _out_chns = in_channels, params["n_features"]
154         blocks.append(
155             Convolution(
156                 dimensions=spatial_dims,
157                 in_channels=_in_chns,
158                 out_channels=_out_chns,
159                 kernel_size=params["kernel_size"],
160                 adn_ordering="NA",
161                 act=acti_type,
162                 norm=norm_type,
163                 bias=bias,
164             )
165         )
166 
167         # residual blocks
168         for (idx, params) in enumerate(layer_params[1:-2]):  # res blocks except the 1st and last two conv layers.
169             _in_chns, _out_chns = _out_chns, params["n_features"]
170             _dilation = 2 ** idx
171             for _ in range(params["repeat"]):
172                 blocks.append(
173                     HighResBlock(
174                         spatial_dims=spatial_dims,
175                         in_channels=_in_chns,
176                         out_channels=_out_chns,
177                         kernels=params["kernels"],
178                         dilation=_dilation,
179                         norm_type=norm_type,
180                         acti_type=acti_type,
181                         bias=bias,
182                         channel_matching=channel_matching,
183                     )
184                 )
185                 _in_chns = _out_chns
186 
187         # final conv layers
188         params = layer_params[-2]
189         _in_chns, _out_chns = _out_chns, params["n_features"]
190         blocks.append(
191             Convolution(
192                 dimensions=spatial_dims,
193                 in_channels=_in_chns,
194                 out_channels=_out_chns,
195                 kernel_size=params["kernel_size"],
196                 adn_ordering="NAD",
197                 act=acti_type,
198                 norm=norm_type,
199                 bias=bias,
200                 dropout=dropout_prob,
201             )
202         )
203 
204         params = layer_params[-1]
205         _in_chns = _out_chns
206         blocks.append(
207             Convolution(
208                 dimensions=spatial_dims,
209                 in_channels=_in_chns,
210                 out_channels=out_channels,
211                 kernel_size=params["kernel_size"],
212                 adn_ordering="NAD",
213                 act=acti_type,
214                 norm=norm_type,
215                 bias=bias,
216                 dropout=dropout_prob,
217             )
218         )
219 
220         self.blocks = nn.Sequential(*blocks)
221 
222     def forward(self, x: torch.Tensor) -> torch.Tensor:
223         return torch.as_tensor(self.blocks(x))
224
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/monai/networks/nets/highresnet.py b/monai/networks/nets/highresnet.py
--- a/monai/networks/nets/highresnet.py
+++ b/monai/networks/nets/highresnet.py
@@ -90,6 +90,7 @@
                     kernel_size=kernel_size,
                     dilation=dilation,
                     bias=bias,
+                    conv_only=True,
                 )
             )
             _in_chns = _out_chns

{"golden_diff": "diff --git a/monai/networks/nets/highresnet.py b/monai/networks/nets/highresnet.py\n--- a/monai/networks/nets/highresnet.py\n+++ b/monai/networks/nets/highresnet.py\n@@ -90,6 +90,7 @@\n                     kernel_size=kernel_size,\n                     dilation=dilation,\n                     bias=bias,\n+                    conv_only=True,\n                 )\n             )\n             _in_chns = _out_chns\n", "issue": "`HighResBlock` may have wrong conv block\nThe `Convolution` block in `HighResBlock` does not utilize acti and norm parameters thus will used default instance norm layer and prelu activation layer. However, it is different from all other `Convolution` blocks in `HighResNet`. Is is a mistake? @wyli \n`HighResBlock` may have wrong conv block\nThe `Convolution` block in `HighResBlock` does not utilize acti and norm parameters thus will used default instance norm layer and prelu activation layer. However, it is different from all other `Convolution` blocks in `HighResNet`. Is is a mistake? @wyli \n", "before_files": [{"content": "# Copyright 2020 - 2021 MONAI Consortium\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#     http://www.apache.org/licenses/LICENSE-2.0\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom typing import Dict, Optional, Sequence, Tuple, Union\n\nimport torch\nimport torch.nn as nn\n\nfrom monai.networks.blocks import ADN, Convolution\nfrom monai.networks.layers.simplelayers import ChannelPad\nfrom monai.utils import ChannelMatching\n\n__all__ = [\"HighResBlock\", \"HighResNet\"]\n\nDEFAULT_LAYER_PARAMS_3D = (\n    # initial conv layer\n    {\"name\": \"conv_0\", \"n_features\": 16, \"kernel_size\": 3},\n    # residual blocks\n    {\"name\": \"res_1\", \"n_features\": 16, \"kernels\": (3, 3), \"repeat\": 3},\n    {\"name\": \"res_2\", \"n_features\": 32, \"kernels\": (3, 3), \"repeat\": 3},\n    {\"name\": \"res_3\", \"n_features\": 64, \"kernels\": (3, 3), \"repeat\": 3},\n    # final conv layers\n    {\"name\": \"conv_1\", \"n_features\": 80, \"kernel_size\": 1},\n    {\"name\": \"conv_2\", \"kernel_size\": 1},\n)\n\n\nclass HighResBlock(nn.Module):\n    def __init__(\n        self,\n        spatial_dims: int,\n        in_channels: int,\n        out_channels: int,\n        kernels: Sequence[int] = (3, 3),\n        dilation: Union[Sequence[int], int] = 1,\n        norm_type: Union[Tuple, str] = (\"batch\", {\"affine\": True}),\n        acti_type: Union[Tuple, str] = (\"relu\", {\"inplace\": True}),\n        bias: bool = False,\n        channel_matching: Union[ChannelMatching, str] = ChannelMatching.PAD,\n    ) -> None:\n        \"\"\"\n        Args:\n            spatial_dims: number of spatial dimensions of the input image.\n            in_channels: number of input channels.\n            out_channels: number of output channels.\n            kernels: each integer k in `kernels` corresponds to a convolution layer with kernel size k.\n            dilation: spacing between kernel elements.\n            norm_type: feature normalization type and arguments.\n                Defaults to ``(\"batch\", {\"affine\": True})``.\n            acti_type: {``\"relu\"``, ``\"prelu\"``, ``\"relu6\"``}\n                Non-linear activation using ReLU or PReLU. Defaults to ``\"relu\"``.\n            bias: whether to have a bias term in convolution blocks. Defaults to False.\n                According to `Performance Tuning Guide <https://pytorch.org/tutorials/recipes/recipes/tuning_guide.html>`_,\n                if a conv layer is directly followed by a batch norm layer, bias should be False.\n            channel_matching: {``\"pad\"``, ``\"project\"``}\n                Specifies handling residual branch and conv branch channel mismatches. Defaults to ``\"pad\"``.\n\n                - ``\"pad\"``: with zero padding.\n                - ``\"project\"``: with a trainable conv with kernel size one.\n\n        Raises:\n            ValueError: When ``channel_matching=pad`` and ``in_channels > out_channels``. Incompatible values.\n\n        \"\"\"\n        super(HighResBlock, self).__init__()\n        self.chn_pad = ChannelPad(\n            spatial_dims=spatial_dims, in_channels=in_channels, out_channels=out_channels, mode=channel_matching\n        )\n\n        layers = nn.ModuleList()\n        _in_chns, _out_chns = in_channels, out_channels\n\n        for kernel_size in kernels:\n            layers.append(\n                ADN(ordering=\"NA\", in_channels=_in_chns, act=acti_type, norm=norm_type, norm_dim=spatial_dims)\n            )\n            layers.append(\n                Convolution(\n                    dimensions=spatial_dims,\n                    in_channels=_in_chns,\n                    out_channels=_out_chns,\n                    kernel_size=kernel_size,\n                    dilation=dilation,\n                    bias=bias,\n                )\n            )\n            _in_chns = _out_chns\n\n        self.layers = nn.Sequential(*layers)\n\n    def forward(self, x: torch.Tensor) -> torch.Tensor:\n        x_conv: torch.Tensor = self.layers(x)\n        return x_conv + torch.as_tensor(self.chn_pad(x))\n\n\nclass HighResNet(nn.Module):\n    \"\"\"\n    Reimplementation of highres3dnet based on\n    Li et al., \"On the compactness, efficiency, and representation of 3D\n    convolutional networks: Brain parcellation as a pretext task\", IPMI '17\n\n    Adapted from:\n    https://github.com/NifTK/NiftyNet/blob/v0.6.0/niftynet/network/highres3dnet.py\n    https://github.com/fepegar/highresnet\n\n    Args:\n        spatial_dims: number of spatial dimensions of the input image.\n        in_channels: number of input channels.\n        out_channels: number of output channels.\n        norm_type: feature normalization type and arguments.\n            Defaults to ``(\"batch\", {\"affine\": True})``.\n        acti_type: activation type and arguments.\n            Defaults to ``(\"relu\", {\"inplace\": True})``.\n        dropout_prob: probability of the feature map to be zeroed\n            (only applies to the penultimate conv layer).\n        bias: whether to have a bias term in convolution blocks. Defaults to False.\n            According to `Performance Tuning Guide <https://pytorch.org/tutorials/recipes/recipes/tuning_guide.html>`_,\n            if a conv layer is directly followed by a batch norm layer, bias should be False.\n        layer_params: specifying key parameters of each layer/block.\n        channel_matching: {``\"pad\"``, ``\"project\"``}\n            Specifies handling residual branch and conv branch channel mismatches. Defaults to ``\"pad\"``.\n\n            - ``\"pad\"``: with zero padding.\n            - ``\"project\"``: with a trainable conv with kernel size one.\n    \"\"\"\n\n    def __init__(\n        self,\n        spatial_dims: int = 3,\n        in_channels: int = 1,\n        out_channels: int = 1,\n        norm_type: Union[str, tuple] = (\"batch\", {\"affine\": True}),\n        acti_type: Union[str, tuple] = (\"relu\", {\"inplace\": True}),\n        dropout_prob: Optional[Union[Tuple, str, float]] = 0.0,\n        bias: bool = False,\n        layer_params: Sequence[Dict] = DEFAULT_LAYER_PARAMS_3D,\n        channel_matching: Union[ChannelMatching, str] = ChannelMatching.PAD,\n    ) -> None:\n\n        super(HighResNet, self).__init__()\n        blocks = nn.ModuleList()\n\n        # initial conv layer\n        params = layer_params[0]\n        _in_chns, _out_chns = in_channels, params[\"n_features\"]\n        blocks.append(\n            Convolution(\n                dimensions=spatial_dims,\n                in_channels=_in_chns,\n                out_channels=_out_chns,\n                kernel_size=params[\"kernel_size\"],\n                adn_ordering=\"NA\",\n                act=acti_type,\n                norm=norm_type,\n                bias=bias,\n            )\n        )\n\n        # residual blocks\n        for (idx, params) in enumerate(layer_params[1:-2]):  # res blocks except the 1st and last two conv layers.\n            _in_chns, _out_chns = _out_chns, params[\"n_features\"]\n            _dilation = 2 ** idx\n            for _ in range(params[\"repeat\"]):\n                blocks.append(\n                    HighResBlock(\n                        spatial_dims=spatial_dims,\n                        in_channels=_in_chns,\n                        out_channels=_out_chns,\n                        kernels=params[\"kernels\"],\n                        dilation=_dilation,\n                        norm_type=norm_type,\n                        acti_type=acti_type,\n                        bias=bias,\n                        channel_matching=channel_matching,\n                    )\n                )\n                _in_chns = _out_chns\n\n        # final conv layers\n        params = layer_params[-2]\n        _in_chns, _out_chns = _out_chns, params[\"n_features\"]\n        blocks.append(\n            Convolution(\n                dimensions=spatial_dims,\n                in_channels=_in_chns,\n                out_channels=_out_chns,\n                kernel_size=params[\"kernel_size\"],\n                adn_ordering=\"NAD\",\n                act=acti_type,\n                norm=norm_type,\n                bias=bias,\n                dropout=dropout_prob,\n            )\n        )\n\n        params = layer_params[-1]\n        _in_chns = _out_chns\n        blocks.append(\n            Convolution(\n                dimensions=spatial_dims,\n                in_channels=_in_chns,\n                out_channels=out_channels,\n                kernel_size=params[\"kernel_size\"],\n                adn_ordering=\"NAD\",\n                act=acti_type,\n                norm=norm_type,\n                bias=bias,\n                dropout=dropout_prob,\n            )\n        )\n\n        self.blocks = nn.Sequential(*blocks)\n\n    def forward(self, x: torch.Tensor) -> torch.Tensor:\n        return torch.as_tensor(self.blocks(x))\n", "path": "monai/networks/nets/highresnet.py"}], "after_files": [{"content": "# Copyright 2020 - 2021 MONAI Consortium\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#     http://www.apache.org/licenses/LICENSE-2.0\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom typing import Dict, Optional, Sequence, Tuple, Union\n\nimport torch\nimport torch.nn as nn\n\nfrom monai.networks.blocks import ADN, Convolution\nfrom monai.networks.layers.simplelayers import ChannelPad\nfrom monai.utils import ChannelMatching\n\n__all__ = [\"HighResBlock\", \"HighResNet\"]\n\nDEFAULT_LAYER_PARAMS_3D = (\n    # initial conv layer\n    {\"name\": \"conv_0\", \"n_features\": 16, \"kernel_size\": 3},\n    # residual blocks\n    {\"name\": \"res_1\", \"n_features\": 16, \"kernels\": (3, 3), \"repeat\": 3},\n    {\"name\": \"res_2\", \"n_features\": 32, \"kernels\": (3, 3), \"repeat\": 3},\n    {\"name\": \"res_3\", \"n_features\": 64, \"kernels\": (3, 3), \"repeat\": 3},\n    # final conv layers\n    {\"name\": \"conv_1\", \"n_features\": 80, \"kernel_size\": 1},\n    {\"name\": \"conv_2\", \"kernel_size\": 1},\n)\n\n\nclass HighResBlock(nn.Module):\n    def __init__(\n        self,\n        spatial_dims: int,\n        in_channels: int,\n        out_channels: int,\n        kernels: Sequence[int] = (3, 3),\n        dilation: Union[Sequence[int], int] = 1,\n        norm_type: Union[Tuple, str] = (\"batch\", {\"affine\": True}),\n        acti_type: Union[Tuple, str] = (\"relu\", {\"inplace\": True}),\n        bias: bool = False,\n        channel_matching: Union[ChannelMatching, str] = ChannelMatching.PAD,\n    ) -> None:\n        \"\"\"\n        Args:\n            spatial_dims: number of spatial dimensions of the input image.\n            in_channels: number of input channels.\n            out_channels: number of output channels.\n            kernels: each integer k in `kernels` corresponds to a convolution layer with kernel size k.\n            dilation: spacing between kernel elements.\n            norm_type: feature normalization type and arguments.\n                Defaults to ``(\"batch\", {\"affine\": True})``.\n            acti_type: {``\"relu\"``, ``\"prelu\"``, ``\"relu6\"``}\n                Non-linear activation using ReLU or PReLU. Defaults to ``\"relu\"``.\n            bias: whether to have a bias term in convolution blocks. Defaults to False.\n                According to `Performance Tuning Guide <https://pytorch.org/tutorials/recipes/recipes/tuning_guide.html>`_,\n                if a conv layer is directly followed by a batch norm layer, bias should be False.\n            channel_matching: {``\"pad\"``, ``\"project\"``}\n                Specifies handling residual branch and conv branch channel mismatches. Defaults to ``\"pad\"``.\n\n                - ``\"pad\"``: with zero padding.\n                - ``\"project\"``: with a trainable conv with kernel size one.\n\n        Raises:\n            ValueError: When ``channel_matching=pad`` and ``in_channels > out_channels``. Incompatible values.\n\n        \"\"\"\n        super(HighResBlock, self).__init__()\n        self.chn_pad = ChannelPad(\n            spatial_dims=spatial_dims, in_channels=in_channels, out_channels=out_channels, mode=channel_matching\n        )\n\n        layers = nn.ModuleList()\n        _in_chns, _out_chns = in_channels, out_channels\n\n        for kernel_size in kernels:\n            layers.append(\n                ADN(ordering=\"NA\", in_channels=_in_chns, act=acti_type, norm=norm_type, norm_dim=spatial_dims)\n            )\n            layers.append(\n                Convolution(\n                    dimensions=spatial_dims,\n                    in_channels=_in_chns,\n                    out_channels=_out_chns,\n                    kernel_size=kernel_size,\n                    dilation=dilation,\n                    bias=bias,\n                    conv_only=True,\n                )\n            )\n            _in_chns = _out_chns\n\n        self.layers = nn.Sequential(*layers)\n\n    def forward(self, x: torch.Tensor) -> torch.Tensor:\n        x_conv: torch.Tensor = self.layers(x)\n        return x_conv + torch.as_tensor(self.chn_pad(x))\n\n\nclass HighResNet(nn.Module):\n    \"\"\"\n    Reimplementation of highres3dnet based on\n    Li et al., \"On the compactness, efficiency, and representation of 3D\n    convolutional networks: Brain parcellation as a pretext task\", IPMI '17\n\n    Adapted from:\n    https://github.com/NifTK/NiftyNet/blob/v0.6.0/niftynet/network/highres3dnet.py\n    https://github.com/fepegar/highresnet\n\n    Args:\n        spatial_dims: number of spatial dimensions of the input image.\n        in_channels: number of input channels.\n        out_channels: number of output channels.\n        norm_type: feature normalization type and arguments.\n            Defaults to ``(\"batch\", {\"affine\": True})``.\n        acti_type: activation type and arguments.\n            Defaults to ``(\"relu\", {\"inplace\": True})``.\n        dropout_prob: probability of the feature map to be zeroed\n            (only applies to the penultimate conv layer).\n        bias: whether to have a bias term in convolution blocks. Defaults to False.\n            According to `Performance Tuning Guide <https://pytorch.org/tutorials/recipes/recipes/tuning_guide.html>`_,\n            if a conv layer is directly followed by a batch norm layer, bias should be False.\n        layer_params: specifying key parameters of each layer/block.\n        channel_matching: {``\"pad\"``, ``\"project\"``}\n            Specifies handling residual branch and conv branch channel mismatches. Defaults to ``\"pad\"``.\n\n            - ``\"pad\"``: with zero padding.\n            - ``\"project\"``: with a trainable conv with kernel size one.\n    \"\"\"\n\n    def __init__(\n        self,\n        spatial_dims: int = 3,\n        in_channels: int = 1,\n        out_channels: int = 1,\n        norm_type: Union[str, tuple] = (\"batch\", {\"affine\": True}),\n        acti_type: Union[str, tuple] = (\"relu\", {\"inplace\": True}),\n        dropout_prob: Optional[Union[Tuple, str, float]] = 0.0,\n        bias: bool = False,\n        layer_params: Sequence[Dict] = DEFAULT_LAYER_PARAMS_3D,\n        channel_matching: Union[ChannelMatching, str] = ChannelMatching.PAD,\n    ) -> None:\n\n        super(HighResNet, self).__init__()\n        blocks = nn.ModuleList()\n\n        # initial conv layer\n        params = layer_params[0]\n        _in_chns, _out_chns = in_channels, params[\"n_features\"]\n        blocks.append(\n            Convolution(\n                dimensions=spatial_dims,\n                in_channels=_in_chns,\n                out_channels=_out_chns,\n                kernel_size=params[\"kernel_size\"],\n                adn_ordering=\"NA\",\n                act=acti_type,\n                norm=norm_type,\n                bias=bias,\n            )\n        )\n\n        # residual blocks\n        for (idx, params) in enumerate(layer_params[1:-2]):  # res blocks except the 1st and last two conv layers.\n            _in_chns, _out_chns = _out_chns, params[\"n_features\"]\n            _dilation = 2 ** idx\n            for _ in range(params[\"repeat\"]):\n                blocks.append(\n                    HighResBlock(\n                        spatial_dims=spatial_dims,\n                        in_channels=_in_chns,\n                        out_channels=_out_chns,\n                        kernels=params[\"kernels\"],\n                        dilation=_dilation,\n                        norm_type=norm_type,\n                        acti_type=acti_type,\n                        bias=bias,\n                        channel_matching=channel_matching,\n                    )\n                )\n                _in_chns = _out_chns\n\n        # final conv layers\n        params = layer_params[-2]\n        _in_chns, _out_chns = _out_chns, params[\"n_features\"]\n        blocks.append(\n            Convolution(\n                dimensions=spatial_dims,\n                in_channels=_in_chns,\n                out_channels=_out_chns,\n                kernel_size=params[\"kernel_size\"],\n                adn_ordering=\"NAD\",\n                act=acti_type,\n                norm=norm_type,\n                bias=bias,\n                dropout=dropout_prob,\n            )\n        )\n\n        params = layer_params[-1]\n        _in_chns = _out_chns\n        blocks.append(\n            Convolution(\n                dimensions=spatial_dims,\n                in_channels=_in_chns,\n                out_channels=out_channels,\n                kernel_size=params[\"kernel_size\"],\n                adn_ordering=\"NAD\",\n                act=acti_type,\n                norm=norm_type,\n                bias=bias,\n                dropout=dropout_prob,\n            )\n        )\n\n        self.blocks = nn.Sequential(*blocks)\n\n    def forward(self, x: torch.Tensor) -> torch.Tensor:\n        return torch.as_tensor(self.blocks(x))\n", "path": "monai/networks/nets/highresnet.py"}]}