The issue is strange, as image should have 3 channels if the previous line of code didn’t throw an error.
Here is a small code snippet working as you would expect:
x = torch.randn(1, 3, 24, 24)
output = F.upsample(x, size=(30, 30), mode='bilinear')
print(output.shape)
> torch.Size([1, 3, 30, 30])

Could you print the image shape right before passing it to F.upsample?