一个TensorFlow的例子

import tensorflow as tf

x = tf.constant(1.0, name='input')
w = tf.Variable(0.8, name='weight')
y = tf.multiply(w, x, name='output')
y_ = tf.constant(0.0, name='correct_value')
loss = tf.pow(y - y_, 2, name='loss') train_step = tf.train.GradientDescentOptimizer(0.025).minimize(loss) for value in [x, w, y, y_, loss]:
tf.summary.scalar(value.op.name, value) summaries = tf.summary.merge_all() with tf.Session() as sess:
summary_writer = tf.summary.FileWriter('log_simple_stats', sess.graph)
sess.run(tf.global_variables_initializer())
for i in range(100):
summary_writer.add_summary(sess.run(summaries), i)
sess.run(train_step)

最新文章

  1. jQuery版AJAX简易封装
  2. Collection和Collections的区别?
  3. ipython notebook设置工作路径和自动保存.py文件 ipython_notebook_config.py
  4. <雨季>
  5. (ios实战) UINavigationBar 返回按钮 文本自定义实现
  6. C# WinForm 透明控件 PictureBox透明 分类: WinForm 2014-07-30 13:27 591人阅读 评论(0) 收藏
  7. BZOJ1634: [Usaco2007 Jan]Protecting the Flowers 护花
  8. rapidjson 使用教程
  9. 对JS prototype的理解
  10. 微信小程序注意点与快捷键
  11. 在IIS中如何配置SSL(https)
  12. java 静态变量 静态代码块 加载顺序问题
  13. ASP.NET MVC - XML节点查找
  14. 如何利用 Git 与 GitHub 进行多人协作开发
  15. bzoj4444 国旗计划
  16. Windows 7 系统中开启 ASP.NET State Service 服务的方法
  17. OC ARC之循环引用问题(代码分析)
  18. node auto run / node 自动运行
  19. 深入浅出JavaScript之跨域总结
  20. Nginx随笔

热门文章

  1. C# 报表和打印等
  2. Linux下安装并配置SSH服务
  3. java基础—static关键字
  4. js cookie 操作
  5. Golang 简单 http 代理转发
  6. NodeJS基础API-path相关的问题basename,extname,dirname,parse,format,sep,delimiter,win32,posix
  7. LeetCode之Weekly Contest 92
  8. 前端MVVM模式及其在Vue和React中的体现
  9. OpenCV编译 Make出错 recipe for target 'modules/imgproc/CMakeFiles/opencv_test_imgproc.dir/all' failed
  10. Thonny -- 简洁的 python 轻量级 IDE