In a pytorch network model, if I use nn.ConvTranspose2d and do traced_script_module = torch.jit.trace(model, example) after constructing the model. Whatever the shape size of example tensor is, I can get the output tensor, of which the shape is same as the input image, from traced_script_module.
But if I use nn.Upsample instead of nn.ConvTranspose2d in the model. Strange things happen. I only can get the output tensor which the shape of is the same as example tensor that I used in torch.jit.trace(model, example).
Can anyone explain this strange thing. Is that related to weak_script_method decorator or something?