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' 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. 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 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__":