The implementation of nn.Upsample 56 in >= version 0.4.x has a size kwarg, which allows you to specify an arbitrary height and width for the tensor. That handles upsampling, but the API is, so far, not as general as tf.image.resize_images, which can shrink tensors, too.