Learning Efficiently with Neural Networks: A Theoretical Comparison between Structured and Flat Representations