Skip to content

Commit

Permalink
1478 Fix TorchScript issue in AHNet with PyTorch 1.5 (#1538)
Browse files Browse the repository at this point in the history
* [DLMED] fix TorchScript issue in AHNet

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add test cases

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix torchscript issue in PyTorch 1.5

Signed-off-by: Nic Ma <nma@nvidia.com>
  • Loading branch information
Nic-Ma authored Feb 2, 2021
1 parent 5e8d2a9 commit 97ff1e0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions monai/networks/nets/ahnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,7 @@ def __init__(
self.dense4 = DenseBlock(spatial_dims, ndenselayer, num_init_features, densebn, densegrowth, 0.0)
noutdense4 = num_init_features + densegrowth * ndenselayer

if psp_block_num > 0:
self.psp = PSP(spatial_dims, psp_block_num, noutdense4, upsample_mode)
self.psp = PSP(spatial_dims, psp_block_num, noutdense4, upsample_mode)
self.final = Final(spatial_dims, psp_block_num + noutdense4, out_channels, upsample_mode)

# Initialise parameters
Expand Down Expand Up @@ -511,7 +510,7 @@ def forward(self, x):

sum4 = self.up3(d3) + conv_x
d4 = self.dense4(sum4)
if self.psp_block_num > 0 and self.psp is not None:
if self.psp_block_num > 0:
psp = self.psp(d4)
x = torch.cat((psp, d4), dim=1)
else:
Expand Down

0 comments on commit 97ff1e0

Please sign in to comment.