From 2c2de9ec8c126ca4c46e559d9b7631da80b9efa5 Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Fri, 6 Jan 2023 19:56:04 +0800 Subject: [PATCH] update the docstring for `HoVerNet` and `UpSample` (#5818) Signed-off-by: KumoLiu Fixes #5609. ### Description Update the docstring for `HoVerNet` and `UpSample`. ### Types of changes - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: KumoLiu --- monai/networks/blocks/upsample.py | 3 +++ monai/networks/nets/hovernet.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/monai/networks/blocks/upsample.py b/monai/networks/blocks/upsample.py index ee03aa4e67..425cb743a5 100644 --- a/monai/networks/blocks/upsample.py +++ b/monai/networks/blocks/upsample.py @@ -31,6 +31,9 @@ class UpSample(nn.Sequential): - "nontrainable": uses :py:class:`torch.nn.Upsample`. - "pixelshuffle": uses :py:class:`monai.networks.blocks.SubpixelUpsample`. + This operation will cause non-deterministic when ``mode`` is ``UpsampleMode.NONTRAINABLE``. + Please check the link below for more details: + https://pytorch.org/docs/stable/generated/torch.use_deterministic_algorithms.html#torch.use_deterministic_algorithms This module can optionally take a pre-convolution (often used to map the number of features from `in_channels` to `out_channels`). """ diff --git a/monai/networks/nets/hovernet.py b/monai/networks/nets/hovernet.py index 109d73a8cf..f6cb491511 100644 --- a/monai/networks/nets/hovernet.py +++ b/monai/networks/nets/hovernet.py @@ -416,6 +416,10 @@ class HoVerNet(nn.Module): https://github.com/vqdang/hover_net https://pytorch.org/vision/main/models/generated/torchvision.models.resnet50.html + This network is non-deterministic since it uses `torch.nn.Upsample` with ``UpsampleMode.NONTRAINABLE`` mode which + is implemented with torch.nn.functional.interpolate(). Please check the link below for more details: + https://pytorch.org/docs/stable/generated/torch.use_deterministic_algorithms.html#torch.use_deterministic_algorithms + Args: mode: use original implementation (`HoVerNetMODE.ORIGINAL` or "original") or a faster implementation (`HoVerNetMODE.FAST` or "fast"). Defaults to `HoVerNetMODE.FAST`.