# iOS 应用中的 TF Mobile TensorFlow 通过以下步骤支持 iOS 应用: 1. 通过在项目的根目录中添加名为`Profile`的文件,在您的应用中包含 TF Mobile。将以下内容添加到`Profile`: ```py target 'Name-Of-Your-Project' pod 'TensorFlow-experimental' ``` 1. 运行`pod install`命令下载并安装 TensorFlow 实验舱。 2. 运行`myproject.xcworkspace`命令打开工作区,以便将预测代码添加到应用逻辑中。 要为iOS项目创建自己的TensorFlow二进制文件,请按照[此链接中的说明](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/ios)。 在 iOS 项目中配置 TF 库后,可以通过以下四个步骤调用 TF 模型: 1. 加载模型: ```py PortableReadFileToProto(file_path, &tensorflow_graph); ``` 1. 创建会话: ```py tensorflow::Status s = session->Create(tensorflow_graph); ``` 1. 运行预测或推理并获得输出: ```py std::string input_layer = "input"; std::string output_layer = "output"; std::vector outputs; tensorflow::Status run_status = session->Run( {{input_layer, image_tensor}}, {output_layer}, {}, &outputs); ``` 1. 获取输出数据: ```py tensorflow::Tensor* output = &outputs[0]; ```