Topological obstructions in gradient-based learning