Meta plans to lay off roughly 10% of its workforce as the technology giant steps up its spending on artificial intelligence.