2023年11月29日发(作者:)
python训练模型c语⾔调⽤_在CC++中使⽤TensorFlow预训练
好的模型——直接。。。
现在的深度学习框架⼀般都是基于 Python 来实现,构建、训练、保存和调⽤模型都可以很容易地在 Python 下完成。但有时候,我们在实
际应⽤这些模型的时候可能需要在其他编程语⾔下进⾏,本⽂将通过直接调⽤ TensorFlow 的 C/C++ 接⼝来导⼊ TensorFlow 预训练好
的模型。
2. 导⼊预定义的图和训练好的参数值
// set up your input paths
const string pathToGraph = "/home/senius/python/c_python/test/";
const string checkpointPath = "/home/senius/python/c_python/test/model-10";
auto session = NewSession(SessionOptions()); // 创建会话
if (session == nullptr)
{
throw runtime_error("Could not create Tensorflow session.");
}
{
4. 前向传播得到预测值
if (session == nullptr)
}
/home/senius/tensorflow-r1.4/tensorflow/bazel-genfiles


发布评论