I think the core of both module vs functional is the same. Nearest neighbour does appear to have an additional aspect ratio constraint. Likely a bit more wasteful, but you could then scale both dimensions equally and throw away the extra dimension instead of squeezing.
F.upsample(torch.autograd.Variable(a), size=(20,2))[:,:,:,0]