Inference in Multi-Layer Networks with Matrix-Valued Unknowns