Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
echo "${{ secrets.DOCKER_PW }}" | docker login -u projectmonai --password-stdin
docker push projectmonai/monai:latest
docker logout
docker image prune -f

docker_test_latest:
if: github.repository == 'Project-MONAI/MONAI'
Expand Down
66 changes: 66 additions & 0 deletions monai/networks/blocks/convolutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,34 @@ class Convolution(nn.Sequential):

-- (Conv|ConvTrans) --

For example:

.. code-block:: python

from monai.networks.blocks import Convolution

conv = Convolution(
dimensions=3,
in_channels=1,
out_channels=1,
adn_ordering="ADN",
act=("prelu", {"init": 0.2}),
dropout=0.1,
norm=("layer", {"normalized_shape": (10, 10, 10)}),
)
print(conv)

output::

Convolution(
(conv): Conv3d(1, 1, kernel_size=(3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1))
(adn): ADN(
(A): PReLU(num_parameters=1)
(D): Dropout(p=0.1, inplace=False)
(N): LayerNorm((10, 10, 10), eps=1e-05, elementwise_affine=True)
)
)

Args:
dimensions: number of spatial dimensions.
in_channels: number of input channels.
Expand Down Expand Up @@ -142,6 +170,44 @@ class ResidualUnit(nn.Module):
"""
Residual module with multiple convolutions and a residual connection.

For example:

.. code-block:: python

from monai.networks.blocks import ResidualUnit

convs = ResidualUnit(
dimensions=3,
in_channels=1,
out_channels=1,
adn_ordering="AN",
act=("prelu", {"init": 0.2}),
norm=("layer", {"normalized_shape": (10, 10, 10)}),
)
print(convs)

output::

ResidualUnit(
(conv): Sequential(
(unit0): Convolution(
(conv): Conv3d(1, 1, kernel_size=(3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1))
(adn): ADN(
(A): PReLU(num_parameters=1)
(N): LayerNorm((10, 10, 10), eps=1e-05, elementwise_affine=True)
)
)
(unit1): Convolution(
(conv): Conv3d(1, 1, kernel_size=(3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1))
(adn): ADN(
(A): PReLU(num_parameters=1)
(N): LayerNorm((10, 10, 10), eps=1e-05, elementwise_affine=True)
)
)
)
(residual): Identity()
)

Args:
dimensions: number of spatial dimensions.
in_channels: number of input channels.
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ mypy>=0.790
ninja
torchvision
psutil
Sphinx==3.3.0
Sphinx==3.5.3
recommonmark==0.6.0
sphinx-autodoc-typehints==1.11.1
sphinx-rtd-theme==0.5.0
sphinx-rtd-theme==0.5.2
cucim==0.18.2
openslide-python==1.1.2
2 changes: 1 addition & 1 deletion tests/test_crf_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def test(self, test_case_description, params, input, features, expected):
output = crf(input_tensor, feature_tensor).cpu().numpy()

# Ensure result are as expected
np.testing.assert_allclose(output, expected, atol=1e-4, rtol=1e-4)
np.testing.assert_allclose(output, expected, atol=1e-3, rtol=1e-3)


if __name__ == "__main__":
Expand Down