Machine-learning based particle-flow algorithm in CMS