Unsupervised Learning of Invariant Representations in Hierarchical Architectures