准备学习tensorflow,首先记录下 第一次测试程序
一、实现 输出hello world
#!/usr/bin/env python
import tensorflow as tf
sess = tf.Session()
hello = tf.constant("hello World!",dtype=tf.string)
print(sess.run(hello))
下面学习下如何导入 mnist 数据库,后面学习要用到这个数据库
二、导入mnist 数据库
#!/user/bin/env python
import tensorflow as tf
#下面导入数据库,按照tensorflow 实战上面的书写方式 导入总是失败
from tensorflow.examples.tutorials import mnist
mnist_data = mnist.input_data.read_data_sets('/data/mnist', one_hot=True)
print("Training data size:",mnist_data.train.num_examples)
print("Validating data size:",mnist_data.validation.num_examples)
print("Testing data size:",mnist_data.test.num_examples)
print("Example Training data:",mnist_data.train.images[0])
print("Example Training data label:",mnist_data.train.labels[0])
三、参考的书籍
《tensorflow 实战》 黄文坚