Calculate layer-wise recosntruction error