chapter1 #变量 import tensorflow as tf x = tf.Variable([1,2]) a = tf.constant([3,3]) #增加一个减法op sub = tf.subtract(x,a) #增加一个假发op add = tf.add(x,sub) #初始化所有变量 init = tf.global_variables_initializer() with tf.Session() as sess: #变量初始化操作 sess.run(init) pri
在学习TensorFlow的过程中,我们需要知道某个tensor的值是什么,这个很重要,尤其是在debug的时候.也许你会说,这个很容易啊,直接print就可以了.其实不然,print只能打印输出shape的信息,而要打印输出tensor的值,需要借助class tf.Session, class tf.InteractiveSession.因为我们在建立graph的时候,只建立tensor的结构形状信息,并没有执行数据的操作. 一 class tf.Session 运行tensorflow操作
在之前的Demo中,我们使用了条件GAN来生成了手写数字图像.那么除了生成数字图像以外我们还能用神经网络来干些什么呢? 在本案例中,我们用神经网络来给口袋妖怪的线框图上色. 第一步: 导入使用库 from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf tf.enable_eager_execution() import numpy as n