Bulk-boundary decomposition of neural networks