Meta’s shares rose in after-hours trading even as it forecast increasing expenses on its artificial intelligence efforts.