Tensorflow入门一 实现自编码
来源:互联网 发布:海湾crt软件下载 编辑:程序博客网 时间:2024/06/05 01:15
from tensorflow.examples.tutorials.mnist import input_data#引入数据集mnist= input_data.read_data_sets("MNIST_data/",one_hot=True)print(mnist.train.images.shape,mnist.train.labels.shape)#显示数据集的格式大小import tensorflow as tfsess=tf.InteractiveSession()#创建Sessionx=tf.placeholder(tf.float32,[None,784])#创建XW=tf.Variable(tf.zeros([784,10]))b=tf.Variable(tf.zeros([10]))#创建变量y=tf.nn.softmax(tf.matmul(x,W)+b)#定义计算y_=tf.placeholder(tf.float32,[None,10])cross_entropy=tf.reduce_mean(-tf.reduce_sum(y_*tf.log(y),reduction_indices=[1]))train_step=tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)tf.global_variables_initializer().run()for i in range(1000): batch_xs,batch_ys=mnist.train.next_batch(100) train_step.run({x:batch_xs,y_:batch_ys})correct_prediction=tf.equal(tf.argmax(y,1),tf.argmax(y_,1))accuracy=tf.reduce_mean(tf.cast(correct_prediction,tf.float32))print(accuracy.eval({x:mnist.test.images,y_:mnist.test.labels}))
很多都是书上的,一起学习吧
阅读全文
0 0
- Tensorflow入门一 实现自编码
- TensorFlow实现自编码
- Tensorflow 实现自编码
- tensorflow Examples:<3>实现自编码
- tensorflow实现自编码器
- Tensorflow实现自编码器
- tensorflow实现自编码器
- TensorFlow实现自编码器
- TensorFlow实现自编码器
- Tensorflow实现自编码器
- TensorFlow入门一
- tensorflow入门(一)
- TensorFlow入门(一)
- TensorFlow教程:TensorFlow实现自编码器
- TensorFlow的自编码网络实现(MNIST无监督学习)
- Tensorflow入门-实现神经网络
- Tensorflow入门-实现神经网络
- Tensorflow入门-实现神经网络
- JVM 垃圾收集器
- jQuery性能优化方法
- js下的正则表达式
- golang常量
- java设计模式文章整理
- Tensorflow入门一 实现自编码
- git版本管理软件——git储藏
- 区块链技术是什么?未来可能用于哪些方面?
- 勒索病毒傀儡进程脱壳
- 科普:并行计算、分布式计算、集群计算和云计算
- 牛客网日常刷题错题汇总2017-09-07
- 在dos中.exe的运行过程
- iOS自定义封装tabBar
- hibernate简单程序,实现从页面对数据库的增删改查(主从表关联)