I am implementing SCAE 2. Which is a type of Convolutional Autoencoder
One of the operations in the decoder network is a  Max Up-Pool layer (technically it is not a layer as it does not have wrights). Max Up Pool adds zeros at alternate positions in the upscaled tensor. This can be illustrated below:

My input tensor’s shape is 1* 4 * 64 and I need to upsample it to 1* 4 * 128 shape using the Max Up-pooing. I made the below function to perform max up pooling:
def maxUpPool(self, inpTensor):
    up_sampled = torch.zeros(inpTensor.shape[0], inpTensor.shape[1], inpTensor.shape[2] * 2)
    up_sampled[:, :, ::2] = inpTensor
    return up_sampled

Is this the right approach to perform this operation ? I doubt if the back propagation will work since I have made a new tensor and it might not have the history of the operations performed on the inpTensor.
EDIT: Yes, the autograd engine is able to keep tracking history. So backpropagation is working. The approach suggested by @vainaijr is yielding similar results with the above mentioned approach.