TensorFlow源代码学习–1 Session API reference

TensorFlow源代码学习–1 Session API reference学习TensorFlow源代码,先把API文档扒出来研究一下整体结构:一下是文档内容的整理,简单翻译一下

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

TensorFlow源代码学习--1 Session API reference
学习TensorFlow源代码,先把API文档扒出来研究一下整体结构: 一下是文档内容的整理,简单翻译一下
原文地址:http://www.tcvpr.com/archives/181

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++: TensorFlow的C++ API只包含执行图(graphs)的操作,像V0.5一样,控制执行图如下:

  1. Build the computation graph using the [Python API].
  • 使用Python API建立一个图
  1. Use [tf.train.write_graph()] to write the graph to a file.
  • 使用[tf.train.write_graph()]把图写入文件

Env

[tensorflow::Env]

  • An interface used by the tensorflow implementation to access operating system functionality like the filesystem etc.Callers may wish to provide a custom Env object to get fine grain control.All Env implementations are safe for concurrent access from multiple threads without any external synchronization.
  • TensorFlow使用此接口接入操作系统功能,例如文件系统等。调用者可以提供自定义的ENV对象来得到细粒度的控制(fine grain control),ENV所有的执行对于并发多线程完全支持,不需要外部同步!

[tensorflow::RandomAccessFile]

  • A file abstraction for randomly reading the contents of a file.
  • 一个文件的抽象,为了从文件中随机读取内容

[tensorflow::WritableFile]

  • A file abstraction for sequential writing.The implementation must provide buffering since callers may append small fragments at a time to the file.
  • 一个文件的抽象,用于按照序列存储文件,此执行必须提供Buffer,因为调用者对于一个文件一次可能只增加小的片段。

[tensorflow::EnvWrapper]

  • An implementation of Env that forwards all calls to another Env .May be useful to clients who wish to override just part of the functionality of another Env .
  • ENV的一个执行,将ENV的所有调用链接到其他ENV。对于想要重载(override)其他ENV部分功能的用户,此类可能有用。

Session

[tensorflow::Session]

  • A Session instance lets a caller drive a TensorFlow graph computation.When a Session is created with a given target, a new Session object is bound to the universe of resources specified by that target. Those resources are available to this session to perform computation described in the GraphDef. After extending the session with a graph, the caller uses the Run() API to perform the computation and potentially fetch outputs as Tensors.

  • 一个Session的实例,可以调用者启动一个TensorFlow图(graph)的计算功能。当一个有目标的Session建立时,一个新的Session对象一定是所有目标(target)指定的资源的总体。那些资源对于此Session是可用的,用来执行在图中定义(GraphDef)的计算。

  • Example:

  • 例子

    //c++ tensorflow::GraphDef graph;

    // … Create or load graph into “graph”. // This example uses the default options which connects // to a local runtime.

    tensorflow::SessionOptions options; std::unique_ptrtensorflow::Session session(tensorflow::NewSession(options));

    // Create the session with this graph.

    tensorflow::Status s = session->Create(graph); if (!s.ok()) { … } // Run the graph and fetch the first output of the “output” // operation, and also run to but do not return anything // for the “update_state” operation.

    std::vectortensorflow::Tensor outputs; s = session->Run({}, {“output:0”}, {“update_state”}, &outputs); if (!s.ok()) { … } // Map the output as a flattened float tensor, and do something // with it.

    auto output_tensor = outputs[0].flat(); if (output_tensor(0) > 0.5) { … } // Close the session to release the resources associated with // this session.

    session->Close();

  • A Session allows concurrent calls to Run() , though a Session must be created / extended by a single thread.Only one thread must call Close() , and Close() must only be called after all other calls to Run() have returned.

  • Session允许多个线程执行Run,但是Session必须由一个线程创建/扩展。只有一个线程能调用Close,并且必须在其他线程中的所有Run调用完成后。

[tensorflow::SessionOptions]

  • Configuration information for a Session
  • Session的配置信息

Status

[tensorflow::Status]

  • No description
  • 状态信息,文档无描述

[tensorflow::Status::State]

  • No description
  • 状态信息,文档无描述

Tensor

[tensorflow::Tensor]

  • Represents an n-dimensional array of values.
  • 表示一个N维值的数组

[tensorflow::TensorShape]

  • No description
  • Tensor形状,文档无描述

[tensorflow::TensorShapeDim]

  • No description
  • Tensor形状维数,文档无描述

[tensorflow::TensorShapeUtils]

  • Static helper routines for TensorShape. Includes a few common predicates on a tensor shape.
  • 对于TensorShape静态辅助例子,包括一些对于tensor形状的常见限定

[tensorflow::PartialTensorShape]

  • Manages the partially known dimensions of a Tensor and their sizes.
  • 管理一个Tensor部分已知的规模以及大小

[tensorflow::PartialTensorShapeUtils]

  • Static helper routines for PartialTensorShape. Includes a few common predicates on a partially known tensor shape.
  • 对于PartialTensorShape静态辅助例子,包括一些对于部分tensor形状的常见限定

[TF_Buffer]

  • No description
  • TensorFlow的Buffer,文档无描述

Thread

[tensorflow::Thread]

  • No Description
  • 线程操作,文档无描述

[tensorflow::ThreadOptions]

  • Options to configure a Thread .Note that the options are all hints, and the underlying implementation may choose to ignore it.
  • 线程配置,注意:这些描述都是隐藏的,底层实现可以忽略
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/183592.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • 达梦数据库安装及配置图文教程 附DM8安装包

    达梦数据库安装及配置图文教程 附DM8安装包达梦数据库的安装欢迎使用新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML图表FLowchart流程图导出与导入导出导入欢迎使用你好!这是你第一次使用M…

  • 史上最全最详细的Anaconda安装教程[通俗易懂]

    史上最全最详细的Anaconda安装教程[通俗易懂]目录1.Anaconda简介2.Anaconda安装情况的选择2.1情况一2.1.1Anaconda的下载2.1.2测试安装2.1.3更改源2.1.4更新包2.1.5创建和管理虚拟环境2.2情况二2.2.1方法一:通过更改python.exe文件名2.2.2方法二:通过切换虚拟环境3.结束语1.Anaconda简介…

  • 数值分析(一) 牛顿插值法及matlab代码

    数值分析(一) 牛顿插值法及matlab代码目录数学:数值分析一、牛顿插值法原理1.牛顿插值多项式2.差商2.1定义2.2性质2.3差商表3.牛顿(Newton)插值公式二、牛顿插值公式matlab代码1.matlab实时在线脚本2.牛顿插值代码3.实例三、总结数学:数值分析  刚上完数值分析课在其中学习了不少的知识,课后还做了一些课程实验主要都是利用matlab编程来解决问题,接下先讲插值法中的牛顿插值法一、牛顿插值法原理1.牛顿插值多项式  定义牛顿插值多项式为:Nn(x)=a0+a1(x−x0)+a2(x−x0)(x−

  • Windows注入与拦截(1) — DLL注入的基本原理「建议收藏」

    Windows注入与拦截(1) — DLL注入的基本原理「建议收藏」一.DLL注入技术的用途从前面的《Windows内存体系》系列文章中我们可以知道,在Windows系统中,每个进程都有自己私有的地址空间。当我们用指针来引用内存的时候,指针的值表示的是进程自己的地址空间的一个虚拟的内存地址。进程不能通过指针来引用其他进程地址空间的内存。因此,如果一个进程有缺陷会导致其引用和覆盖随机地址处的内存,那么这个缺陷的影响就会不会扩散到其他的进程。独立的地址空间有…

  • 不确定度用计算机怎么算,算A类不确定度用计算器该怎样按[通俗易懂]

    不确定度用计算机怎么算,算A类不确定度用计算器该怎样按[通俗易懂]不可以。根号也只能显示平方根,立方根以上就别想了,这三次方程解出来不知道是几次方根。这种计算器下面那个L-R=0是用来检验的,说明就不是用公式解的,估计是二分法或者什么其它近似解法,L-R=0只是在计算器内部算法允许的精度范围内保证L-R=0,所以肯定不支持根号。A类不确定度的计算方法。n=6时,u(a)=S(x)。数据平均值设为q。用贝塞尔公式S(x)*S(x)=[(X1-q)*(X1-q)+(…

  • html5 sexteen,Prosecutors: Berlusconi had sex with teen 13 times

    html5 sexteen,Prosecutors: Berlusconi had sex with teen 13 timesPremierSilvioBerlusconipaidforsexwithanunder-ageMoroccanteen13timesathisvillanearMilan,prosecutorssaidinadocumentfiledTuesdayseekingindictmentsagainstthreeaidesforallege…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号