title: “CS20SI-1” layout: post date: 2017-09-24 20:48 image: /assets/images/markdown.jpg headerImage: false tag:
Off-the-shelf model are not the main purpose of TensorFlow.
TensorFlow provides an extensive suite of functions and classes that allow users to define models from scratch.
And this is what we are going to learn.
我们不是要使用TensorFlow中现成的模型,而是要学会从零搭建自己的模型。
相对而言,TensorFlow发展迅速,书很快就会过时,所以要通过 官网跟踪最新。
A Session object encapsulates the environment in which Operations objects are executed, and Tensor objects are evaluated.
Session 封装一个计算环境,其中完成了 操作 的执行,并计算相应的 张量 。
这一章在自我摸索的情况下,竟然能够正确输出TensorBoard的展示,也算是一个小意外了。
还是从整体性介绍TensorFlow,有谁在用,为什么要用,该如何使用。
该如何使用 最为重要, 我们希望能够充分利用TensorFlow已经定义好的模块,如各种函数和类,但是最核心的模型部分,还是得从头搭建。
并且特别强调 Computational Graph 计算图这个核心问题。
import tensorflow as tf
x = tf.constant(3, name='x')
y = tf.constant(5, name='y')
add_op = tf.add(x, y)
mul_op = tf.multiply(x, y)
useless = tf.multiply(x, add_op)
pow_op = tf.pow(add_op, mul_op)
with tf.Session() as sess:
print(sess.run(pow_op))
summary_writer = tf.summary.FileWriter('tmp/testtb', sess.graph)
0
