A Topological Framework for Deep Learning