tf.Session
来源:互联网 发布:好看的输入法软件 编辑:程序博客网 时间:2024/05/22 03:02
tf.Session
前言
初入Tensorflow,什么都不理解。于是借助sess = tf.Session()
提出了为什么这么写的问题,以此为基础了解tf的使用。
官方
class tf.Session
A class for running TensorFlow operations.
A Session object encapsulates the environment in which Operation objects are executed, and Tensor objects are evaluated. For example:
# Build a graph.a = tf.constant(5.0)b = tf.constant(6.0)c = a * b# Launch the graph in a session.sess = tf.Session()# Evaluate the tensor `c`.print sess.run(c)
A session may own resources, such as variables, queues, and readers. It is important to release these resources when they are no longer required. To do this, either invoke the close() method on the session, or use the session as a context manager. The following two examples are equivale
# Using the `close()` method.sess = tf.Session()sess.run(...)sess.close()# Using the context manager.with tf.Session() as sess: sess.run(...)
理解
- tf.Session():需要在启动session之前构建整个计算图,然后启动该计算图。
Reference
- 官方文档:Running Graph
阅读全文
0 0
- tf.Session
- tf.InteractiveSession()与tf.Session()
- TF session 会话分析
- tf.InteractiveSession()与tf.Session()的区别
- TensorFlow函数:tf.Session()和tf.Session().as_default()的区别
- TensorFlow学习--tf.session.run()
- tensorflow函数解析: tf.Session() 和tf.InteractiveSession()
- tf.Session().run() | tf.Tensor.eval()--两者等同
- with tf.Session(config=tf.ConfigProto(log_device_placement=True))
- TensorFlow 学习(二)—— tf.Session() 与 tf.Session().run()
- TF
- tf
- tf.scatter_update tf.scatter_sub
- tf.get_variable tf.variable_scope tf.name_scope
- TF/IDF
- TF-IDF
- TF-IDF
- TF-IDF
- Jetty源码分析之ScopedHandler及Handler链
- window平台上基于python搭建一个堡垒级系统
- 12.20学习计划
- JS的事件响应,与网页交互
- 第十二次学习报告
- tf.Session
- 中兴坠楼事件,愿程序员的世界里,不会再有悲剧
- git 理解 HEAD^与HEAD~
- 脏读、幻读、不可重复读
- springboot整合mybatis
- Day08 --代码块 继承 重写 this和super final关键字
- 第二节matlab的变量命名、数据类型和几个常用命令
- ShaderForge-波光铠甲
- earlysuspend、autosleep以及wakeup_count三种休眠机制的分析和比较