The tech giant is cutting jobs across several divisions including Facebook and its Reality Labs unit in overhaul for the artificial intelligence era.