TensorFlow教程之API DOC 6.1.17 TensorFlow C++ Session API reference documentation

简介:

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权。


TensorFlow C++ Session API reference documentation

TensorFlow's public C++ API includes only the API for executing graphs, as of version 0.5. To control the execution of a graph from C++:

  1. Build the computation graph using the Python API.
  2. Use tf.train.write_graph() to write the graph to a file.
  3. Load the graph using the C++ Session API. For example:

    // Reads a model graph definition from disk, and creates a session object you
    // can use to run it.
    Status LoadGraph(string graph_file_name, Session** session) {
     GraphDef graph_def;
     TF_RETURN_IF_ERROR(
         ReadBinaryProto(Env::Default(), graph_file_name, &graph_def));
     TF_RETURN_IF_ERROR(NewSession(SessionOptions(), session));
     TF_RETURN_IF_ERROR((*session)->Create(graph_def));
     return Status::OK();
    }
    
  4. Run the graph with a call to session->Run()

Classes

Structs

相关文章
|
2月前
|
机器学习/深度学习 API 算法框架/工具
【Tensorflow+keras】Keras API三种搭建神经网络的方式及以mnist举例实现
使用Keras API构建神经网络的三种方法:使用Sequential模型、使用函数式API以及通过继承Model类来自定义模型,并提供了基于MNIST数据集的示例代码。
44 12
|
2月前
|
UED 开发工具 iOS开发
Uno Platform大揭秘:如何在你的跨平台应用中,巧妙融入第三方库与服务,一键解锁无限可能,让应用功能飙升,用户体验爆棚!
【8月更文挑战第31天】Uno Platform 让开发者能用同一代码库打造 Windows、iOS、Android、macOS 甚至 Web 的多彩应用。本文介绍如何在 Uno Platform 中集成第三方库和服务,如 Mapbox 或 Google Maps 的 .NET SDK,以增强应用功能并提升用户体验。通过 NuGet 安装所需库,并在 XAML 页面中添加相应控件,即可实现地图等功能。尽管 Uno 平台减少了平台差异,但仍需关注版本兼容性和性能问题,确保应用在多平台上表现一致。掌握正确方法,让跨平台应用更出色。
38 0
|
2月前
|
机器学习/深度学习 API 算法框架/工具
【Tensorflow+keras】Keras API两种训练GAN网络的方式
使用Keras API以两种不同方式训练条件生成对抗网络(CGAN)的示例代码:一种是使用train_on_batch方法,另一种是使用tf.GradientTape进行自定义训练循环。
30 5
|
2月前
|
TensorFlow API 算法框架/工具
【Tensorflow 2】Keras API+Estimator的使用
本文介绍了在TensorFlow 2中结合Keras API和Estimator API来构建和训练模型的方法,并提供了一个示例流程,包括构建模型、生成数据集、使用Estimator进行训练以及评估模型性能。
27 3
|
2月前
|
XML 缓存 API
【Azure API 管理】使用APIM进行XML内容读取时遇见的诡异错误 Expression evaluation failed. Object reference not set to an instance of an object.
【Azure API 管理】使用APIM进行XML内容读取时遇见的诡异错误 Expression evaluation failed. Object reference not set to an instance of an object.
|
2月前
|
Dart API 开发工具
Dart ffi 使用问题之Dart API要在C++中使用,该如何初始化
Dart ffi 使用问题之Dart API要在C++中使用,该如何初始化
|
2月前
|
API 算法框架/工具
【Tensorflow+keras】使用keras API保存模型权重、plot画loss损失函数、保存训练loss值
使用keras API保存模型权重、plot画loss损失函数、保存训练loss值
22 0
|
3月前
|
机器学习/深度学习 TensorFlow API
Keras是一个高层神经网络API,由Python编写,并能够在TensorFlow、Theano或CNTK之上运行。Keras的设计初衷是支持快速实验,能够用最少的代码实现想法,并且能够方便地在CPU和GPU上运行。
Keras是一个高层神经网络API,由Python编写,并能够在TensorFlow、Theano或CNTK之上运行。Keras的设计初衷是支持快速实验,能够用最少的代码实现想法,并且能够方便地在CPU和GPU上运行。
|
4月前
|
存储 算法 编译器
C++ 函数式编程教程
C++ 函数式编程学习
|
4月前
|
存储 编译器 开发工具
C++语言教程分享
C++语言教程分享