MeanPool for rectangular data

Hello, I have been trying to adapt the image model to work with rectangular data, say 5x1024 images instead of normal images. I have found that the only non-compatible section is a layer called ConvMeanPool which involves the mean pooling summation the forward pass:

        output = self.conv(inputs)
        output = sum([output[:, :, ::2, ::2], output[:, :, 1::2, ::2],
                      output[:, :, ::2, 1::2], output[:, :, 1::2, 1::2]]) / 4.
        return output

Which is the only layer that explicitly requires square data with 2 even dimensions. Using rectangular sizes with odd dimensions results in a size mismatch. Are there any recommendations for some way around this?