rwightman/efficientdet-pytorch

jit-traced models won't work with different inputs when recompute_scale_factor is True in Interpolate2d

NicolaiHarich opened this issue · 1 comments

Hi,
after tracing the model with "torch.jit.trace" and an example input I realized that the model won't work when you change the input orientation (e.g. from portrait to landscape).
I believe the reason for this behaviour is that Interpolate2d uses recompute_scale_factor=True.

Is there any reason why you have to enable "recompute_scale_factor"? If not, can we set the recompute_scale_factor to False in the Interpolate2d layer?

input, self.size, self.scale_factor, self.mode, self.align_corners, recompute_scale_factor=True)

@NicolaiHarich I didn't realize there was an interaction btw that param and tracing... I'll take a look and see if it's safe to remove (doesn't impact results).