About torch.nn.Upsample

Your code is fine.
Could you check again that you are not passing another tensor to self.upsample?
This works:

A = torch.randn(3, 10, 10)
upsample = nn.Upsample(size=24, mode='bilinear')
A = torch.unsqueeze(A, 0)
A = upsample(A)
print(A.shape)