Skip to content

Commit

Permalink
Merge pull request #109 from hzdr-MedImaging/fix-upsample-tracerwarning
Browse files Browse the repository at this point in the history
fix tracerwarning when trying to convert a model into torchscript
  • Loading branch information
wolny authored Jan 28, 2024
2 parents 3e02c32 + 73c1bf7 commit 4355dff
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions pytorch3dunet/unet3d/buildingblocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,7 @@ def __init__(self, conv_transposed, is3d):

def forward(self, x, size):
x = self.conv_transposed(x)
if self.is3d:
output_size = x.size()[-3:]
else:
output_size = x.size()[-2:]
if output_size != size:
return F.interpolate(x, size=size)
return x
return F.interpolate(x, size=size)

def __init__(self, in_channels, out_channels, kernel_size=3, scale_factor=2, is3d=True):
# make sure that the output size reverses the MaxPool3d from the corresponding encoder
Expand Down

0 comments on commit 4355dff

Please sign in to comment.