Personally, I would apply the linear layer separately in forward and reshape the output using view after it.
Once you have the right shape, just pass it to the nn.Sequential block, which would then only contain the conv/transposed conv/upsampling layers (3-dim input).