From 9838c1e6f0881d0f25700d85fb2567ff8a226c5b Mon Sep 17 00:00:00 2001 From: Yiheng Wang Date: Thu, 29 Jun 2023 11:36:12 +0800 Subject: [PATCH 1/3] fix efn 3d issue Signed-off-by: Yiheng Wang --- monai/networks/nets/efficientnet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monai/networks/nets/efficientnet.py b/monai/networks/nets/efficientnet.py index 7c2a507fea..d89ab53ea2 100644 --- a/monai/networks/nets/efficientnet.py +++ b/monai/networks/nets/efficientnet.py @@ -163,9 +163,9 @@ def __init__( self._se_adaptpool = adaptivepool_type(1) num_squeezed_channels = max(1, int(in_channels * self.se_ratio)) self._se_reduce = conv_type(in_channels=oup, out_channels=num_squeezed_channels, kernel_size=1) - self._se_reduce_padding = _make_same_padder(self._se_reduce, [1, 1]) + self._se_reduce_padding = _make_same_padder(self._se_reduce, [1] * spatial_dims) self._se_expand = conv_type(in_channels=num_squeezed_channels, out_channels=oup, kernel_size=1) - self._se_expand_padding = _make_same_padder(self._se_expand, [1, 1]) + self._se_expand_padding = _make_same_padder(self._se_expand, [1] * spatial_dims) # Pointwise convolution phase final_oup = out_channels From 16cfcc3e9911554284f6ba0bd618aa2fb8e2fb97 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Thu, 29 Jun 2023 09:48:52 +0100 Subject: [PATCH 2/3] unblock downloading timed out issue Signed-off-by: Wenqi Li --- tests/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/utils.py b/tests/utils.py index 1694ef5384..bd357aa529 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -153,6 +153,7 @@ def skip_if_downloading_fails(): "md5 check", "limit", # HTTP Error 503: Egress is over the account limit "authenticate", + "timed out", # urlopen error [Errno 110] Connection timed out ) ): raise unittest.SkipTest(f"error while downloading: {rt_e}") from rt_e # incomplete download From e79ada9a7f0e92b68c10607ff9d459c6a4ca485a Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Thu, 29 Jun 2023 10:23:44 +0100 Subject: [PATCH 3/3] limit threads Signed-off-by: Wenqi Li --- tests/test_vitautoenc.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_vitautoenc.py b/tests/test_vitautoenc.py index f9f489b9b9..96290f3c2e 100644 --- a/tests/test_vitautoenc.py +++ b/tests/test_vitautoenc.py @@ -65,6 +65,13 @@ class TestPatchEmbeddingBlock(unittest.TestCase): + def setUp(self): + self.threads = torch.get_num_threads() + torch.set_num_threads(4) + + def tearDown(self): + torch.set_num_threads(self.threads) + @parameterized.expand(TEST_CASE_Vitautoenc) @skip_if_windows def test_shape(self, input_param, input_shape, expected_shape):