Args: in_planes: number of input channels. planes: number of output channels. spatial_dims: number of spatial dimensions of the input image. stride: stride to use for first conv layer. downsample: which downsample layer to use.
(
self,
in_planes: int,
planes: int,
spatial_dims: int = 3,
stride: int = 1,
downsample: nn.Module | partial | None = None,
act: str | tuple = ("relu", {"inplace": True}),
norm: str | tuple = "batch",
)
| 72 | expansion = 1 |
| 73 | |
| 74 | def __init__( |
| 75 | self, |
| 76 | in_planes: int, |
| 77 | planes: int, |
| 78 | spatial_dims: int = 3, |
| 79 | stride: int = 1, |
| 80 | downsample: nn.Module | partial | None = None, |
| 81 | act: str | tuple = ("relu", {"inplace": True}), |
| 82 | norm: str | tuple = "batch", |
| 83 | ) -> None: |
| 84 | """ |
| 85 | Args: |
| 86 | in_planes: number of input channels. |
| 87 | planes: number of output channels. |
| 88 | spatial_dims: number of spatial dimensions of the input image. |
| 89 | stride: stride to use for first conv layer. |
| 90 | downsample: which downsample layer to use. |
| 91 | act: activation type and arguments. Defaults to relu. |
| 92 | norm: feature normalization type and arguments. Defaults to batch norm. |
| 93 | """ |
| 94 | super().__init__() |
| 95 | |
| 96 | conv_type: Callable = Conv[Conv.CONV, spatial_dims] |
| 97 | |
| 98 | self.conv1 = conv_type(in_planes, planes, kernel_size=3, padding=1, stride=stride, bias=False) |
| 99 | self.bn1 = get_norm_layer(name=norm, spatial_dims=spatial_dims, channels=planes) |
| 100 | self.act = get_act_layer(name=act) |
| 101 | self.conv2 = conv_type(planes, planes, kernel_size=3, padding=1, bias=False) |
| 102 | self.bn2 = get_norm_layer(name=norm, spatial_dims=spatial_dims, channels=planes) |
| 103 | self.downsample = downsample |
| 104 | self.stride = stride |
| 105 | |
| 106 | def forward(self, x: torch.Tensor) -> torch.Tensor: |
| 107 | residual = x |
nothing calls this directly
no test coverage detected