From 6ecfc4687eec0525cc0ed764bed090f7727b5e93 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Thu, 8 Apr 2021 20:43:24 +0100 Subject: [PATCH 1/4] update convs docstrings Signed-off-by: Wenqi Li --- monai/networks/blocks/convolutions.py | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/monai/networks/blocks/convolutions.py b/monai/networks/blocks/convolutions.py index 7bfb3b47e4..39ce60e3f8 100644 --- a/monai/networks/blocks/convolutions.py +++ b/monai/networks/blocks/convolutions.py @@ -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. @@ -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. From e2d3e346630cce893015cb85feeb358ecf04ad6f Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Fri, 9 Apr 2021 20:37:49 +0100 Subject: [PATCH 2/4] increase tol for cuda crf Signed-off-by: Wenqi Li --- tests/test_crf_cuda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_crf_cuda.py b/tests/test_crf_cuda.py index 6e67d4ec8c..90fe64cd4e 100644 --- a/tests/test_crf_cuda.py +++ b/tests/test_crf_cuda.py @@ -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__": From d6ca8d74b0394a184800be9091f2499cf12d97f5 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Fri, 9 Apr 2021 20:40:20 +0100 Subject: [PATCH 3/4] update requirements according to docs/requirements Signed-off-by: Wenqi Li --- requirements-dev.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index f9a2464495..9ba05fb769 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -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 From d570dd56517da57d33f9d8c54017c4f89d3a9400 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Fri, 9 Apr 2021 22:42:55 +0100 Subject: [PATCH 4/4] prune image Signed-off-by: Wenqi Li --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2745d4169f..54449a8dba 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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'