Rewrite 2nd-layer Learning Code (evaluation and inference of PMCode)