Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions monai/networks/blocks/convolutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class ResidualUnit(nn.Module):
- When dropout_dim = 2, Randomly zero out entire channels (a channel is a 2D feature map).
- When dropout_dim = 3, Randomly zero out entire channels (a channel is a 3D feature map).

The value of dropout_dim should be no larger than the value of `dimensions`.
The value of dropout_dim should be no larger than the value of `spatial_dims`.
dilation: dilation rate. Defaults to 1.
bias: whether to have a bias term. Defaults to True.
last_conv_only: for the last subunit, whether to use the convolutional layer only.
Expand Down Expand Up @@ -269,7 +269,7 @@ def __init__(
self.out_channels = out_channels
self.conv = nn.Sequential()
self.residual = nn.Identity()
if not padding:
if padding is None:
padding = same_padding(kernel_size, dilation)
Comment thread
emianaya marked this conversation as resolved.
schannels = in_channels
sstrides = strides
Expand Down
4 changes: 4 additions & 0 deletions tests/networks/blocks/test_convolutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ def test_dropout1(self):
expected_shape = (1, self.output_channels, self.im_shape[0], self.im_shape[1])
self.assertEqual(out.shape, expected_shape)

def test_padding1(self):
conv = ResidualUnit(2, 1, self.output_channels, kernel_size=1, padding=0)
self.assertEqual(conv.conv.unit0.conv.padding, (0, 0))


if __name__ == "__main__":
unittest.main()
Loading