The Factored 3-way Restricted Boltzmann Machine has encoded the image transformation successfully. But when utilize the code to unknown image, the result was much affected by the feature of training samples. Based on the model, we separated the transformation feature out of the hidden representation and designed a new probabilistic model with gate for learning distributed representations of image transformations. Inference in the model consists extracting the transformation, find the mapping code, training filters to fit for the affine or more general transformations. We also provide experimental results to validate the performance of our model to a various tasks.