Topographic Transformation as a Discrete Latent Variable