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

相关文章
|
1月前
|
存储 网络协议 Ubuntu
【C++网络编程】Socket基础:网络通讯程序入门级教程
【C++网络编程】Socket基础:网络通讯程序入门级教程
55 7
|
1月前
|
编译器 开发工具 C++
Dev-C++详细安装教程及中文设置(附带安装包链接)
Dev-C++详细安装教程及中文设置(附带安装包链接)
79 0
|
2月前
|
API 数据库 C语言
【C/C++ 数据库 sqlite3】SQLite C语言API返回值深入解析
【C/C++ 数据库 sqlite3】SQLite C语言API返回值深入解析
175 0
|
2月前
|
程序员 API 数据库
【Cmake工程 库相关教程 】深入理解CMake工程C/C++ 库管理技巧
【Cmake工程 库相关教程 】深入理解CMake工程C/C++ 库管理技巧
71 1
|
2月前
|
存储 并行计算 前端开发
【C++ 函数 基础教程 第五篇】C++深度解析:函数包裹与异步计算的艺术(二)
【C++ 函数 基础教程 第五篇】C++深度解析:函数包裹与异步计算的艺术
42 1
|
2月前
|
数据安全/隐私保护 C++ 容器
【C++ 函数 基础教程 第五篇】C++深度解析:函数包裹与异步计算的艺术(一)
【C++ 函数 基础教程 第五篇】C++深度解析:函数包裹与异步计算的艺术
53 0
|
2月前
|
设计模式 算法 C++
【C++ 泛型编程 进阶篇】C++元模板编程与设计模式的结合应用教程(二)
【C++ 泛型编程 进阶篇】C++元模板编程与设计模式的结合应用教程
30 0
|
2月前
|
Java 程序员 Maven
【C/C++ CommonAPI入门篇】深入浅出:CommonAPI C++ D-Bus Tools 完全使用教程指南
【C/C++ CommonAPI入门篇】深入浅出:CommonAPI C++ D-Bus Tools 完全使用教程指南
71 0
|
1月前
|
编译器 C语言 C++
VSCode上搭建C/C++开发环境(vscode配置c/c++环境)Windows系统---保姆级教程
VSCode上搭建C/C++开发环境(vscode配置c/c++环境)Windows系统---保姆级教程
|
1月前
|
存储 编译器 程序员
【C++入门篇】保姆级教程篇【中】
【C++入门篇】保姆级教程篇【中】