Does 'nn.Upsample' have parameters?

Hi PyTorchers!
So, I was trying to look up the parameters of pretrained model for fun.
when I run this code,

model = myModel()
for name, param in model.naemed_parameters():
print(’{}: {}’.format(name, param.shape))

I get this line of unexpected code.

Upsample.1.weight: (torch.Size([256, 256, 3, 3]))
Upsample.1.bias: (torch.Size([256]))

myModel class contains the following code in its ‘init’ method.
self.Upsample = torch.nn.Upsample(scale_factor=2, mode=‘bilinear’, True)

Is this normal?

I think you have something additionally somewhere else. There seems to be a sequential model with convolution (?) in Upsample (if you permit a style hint you didn’t ask for: why would you have upper case for your instances?)


shows that Vanilla Upsample module don’t have parameters. If you assign things to them, they will take this, though.
If you want people to look at this, you would likely have to show more of your code.

Best regards


Yes, there are something more in the sequential model like conv operations as you mentioned.
I just didn’t write the whole code because I thought it would be hairy and unnecessary.
Anyway, that works for me. Thanks!