You could write a custom layer which does nothing except reshaping and add this layer in front of your convolutional layer:
class ReshapeLayer(torch.nn.Module):
    def __init__(batch_size, n_channels, height, width):
        self.shape = [batch_size, n_channels, height, width] 
    def forward(self, x):
        return x.view(*self.shape)

EDIT: if you don’t know all of that dimension sizes you could also pass -1 for one dimension. With -1 the dimension is set in a way that it fits to the number of entries in the tensor and is calculated with respect to the other dimensions