tensorflow3

tensorflow 可视化好帮手;

tf.train.SummaryWriter报错,改为tf.summary.FileWriter

软件包安装yum install sqlite-devel
[root@shenzhen tensorflow]# python3 tensor6.py
2018-08-24 21:14:52.513641: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
[root@shenzhen tensorflow]# ls
events.out.tfevents.1535116493.shenzhen.com tensor2.py tensor4.py tensor6.py
tensor1.py tensor3.py tensor5.py
[root@shenzhen tensorflow]# cat tensor6.py
#!/usr/local/bin/python3
#coding:utf-8 import tensorflow as tf def add_layer(inputs,in_size, out_size, activation_function=None):
#add one more layer and return the output of this layer
with tf.name_scope('layer'):
with tf.name_scope('weights'):
Weights = tf.Variable(tf.random_normal([in_size, out_size]),\
name='W')
with tf.name_scope('biases'):
biases = tf.Variable(tf.zeros([1,out_size]) + 0.1,name='b')
with tf.name_scope('Wx_plus_b'):
Wx_plus_b = tf.add(tf.matmul(inputs, Weights),biases)
if activation_function is None:
outputs = Wx_plus_b
else:
outputs = activation_function(Wx_plus_b,)
return outputs #define placeholder for inputs to network
with tf.name_scope('inputs'):
xs = tf.placeholder(tf.float32,[None,1],name='x_input')
ys = tf.placeholder(tf.float32,[None,1],name='y_input') #add hidden layer
l1 = add_layer(xs,1,10,activation_function=tf.nn.relu)
#add output layer
prediction = add_layer(l1,10,1,activation_function=None) #the error between prediction and real data
with tf.name_scope('loss'):
loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction),\
reduction_indices=[1]))
with tf.name_scope('train'):
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss) init = tf.global_variables_initializer()
sess = tf.Session()
writer = tf.summary.FileWriter('.',sess.graph)
#important step
sess.run(init)

#tensorboard    --logdir='/logs/'

访问浏览器:、、、、

1报错位置:.tf.scalar_summary('batch_loss', loss)AttributeError: 'module' object has no attribute 'scalar_summary'修改为:tf.summary.scalar('batch_loss', loss)原因:新版本做了调整

2.AttributeError: 'module' object has no attribute 'histogram_summary'修改为:tf.summary.histogram

3.tf.merge_all_summaries()改为:summary_op = tf.summaries.merge_all()

4.AttributeError: 'module' object has no attribute 'SummaryWriter':tf.train.SummaryWriter改为tf.summary.FileWriter

报错:

tf.scalar_summary(l.op.name + ' (raw)', l)

AttributeError: 'module' object has no attribute 'scalar_summary'

解决:

tf.scalar_summary('images', images)改为:tf.summary.scalar('images', images)

tf.image_summary('images', images)改为:tf.summary.image('images', images)

还有:

tf.train.SummaryWriter改为:tf.summary.FileWriter

tf.merge_all_summaries()改为:summary_op = tf.summary.merge_all

tf.histogram_summary(var.op.name, var)改为:  tf.summary.histogram

concated = tf.concat(1, [indices, sparse_labels])改为:concated = tf.concat([indices, sparse_labels], 1)

框架tensorflow3的更多相关文章

  1. 避免重复造轮子的UI自动化测试框架开发

    一懒起来就好久没更新文章了,其实懒也还是因为忙,今年上半年的加班赶上了去年一年的加班,加班不息啊,好了吐槽完就写写一直打算继续的自动化开发 目前各种UI测试框架层出不穷,但是万变不离其宗,驱动PC浏览 ...

  2. ABP入门系列(1)——学习Abp框架之实操演练

    作为.Net工地搬砖长工一名,一直致力于挖坑(Bug)填坑(Debug),但技术却不见长进.也曾热情于新技术的学习,憧憬过成为技术大拿.从前端到后端,从bootstrap到javascript,从py ...

  3. 旺财速啃H5框架之Bootstrap(五)

    在上一篇<<旺财速啃H5框架之Bootstrap(四)>>做了基本的框架,<<旺财速啃H5框架之Bootstrap(二)>>篇里也大体认识了bootst ...

  4. Angular企业级开发(5)-项目框架搭建

    1.AngularJS Seed项目目录结构 AngularJS官方网站提供了一个angular-phonecat项目,另外一个就是Angular-Seed项目.所以大多数团队会基于Angular-S ...

  5. Scrapy框架爬虫初探——中关村在线手机参数数据爬取

    关于Scrapy如何安装部署的文章已经相当多了,但是网上实战的例子还不是很多,近来正好在学习该爬虫框架,就简单写了个Spider Demo来实践.作为硬件数码控,我选择了经常光顾的中关村在线的手机页面 ...

  6. 制作类似ThinkPHP框架中的PATHINFO模式功能

    一.PATHINFO功能简述 搞PHP的都知道ThinkPHP是一个免费开源的轻量级PHP框架,虽说轻量但它的功能却很强大.这也是我接触学习的第一个框架.TP框架中的URL默认模式即是PathInfo ...

  7. 旺财速啃H5框架之Bootstrap(四)

    上一篇<<旺财速啃H5框架之Bootstrap(三)>>已经把导航做了,接下来搭建内容框架.... 对于不规整的网页,要做成自适应就有点玩大了.... 例如下面这种版式的页面. ...

  8. 一起学 Java(三) 集合框架、数据结构、泛型

    一.Java 集合框架 集合框架是一个用来代表和操纵集合的统一架构.所有的集合框架都包含如下内容: 接口:是代表集合的抽象数据类型.接口允许集合独立操纵其代表的细节.在面向对象的语言,接口通常形成一个 ...

  9. Hibernatel框架关联映射

    Hibernatel框架关联映射 Hibernate程序执行流程: 1.集合映射 需求:网络购物时,用户购买商品,填写地址 每个用户会有不确定的地址数目,或者只有一个或者有很多.这个时候不能把每条地址 ...

随机推荐

  1. Python Redis 发布订阅

    发布者:服务器 订阅者:Dashboad和数据处理 频道主逻辑 import redis class RedisHelper: def __init__(self): # 链接服务端 self.__c ...

  2. 时间序列数据库调研之InfluxDB

    基于 Go 语言开发,社区非常活跃,项目更新速度很快,日新月异,关注度高 测试版本 1.0.0_beta2-1 安装部署 wget https://dl.influxdata.com/influxdb ...

  3. linux --- 5. nginx 初始

    一. 安装nginx 1.安装nginxz之前的依赖包 yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel o ...

  4. SVN冲突以及解决办法

    1.冲突原因: 假设 A.B 两个用户都在版本号为 100 的时候,更新了 kingtuns.txt 这个文件,A 用户在修改完成之后提交 kingtuns.txt 到服务器, 这个时候提交成功,这个 ...

  5. Android中的task和stack

    今天在重新理了一遍intent的过程中发现task是一个神奇的东西,而它又和stack有着很深的联系.task顾名思义是一个任务,但是这个任务可不一定只是来自一个app,比如我用微信来发一张图片,那么 ...

  6. 论文笔记:Structure Inference Net: Object Detection Using Scene-Level Context and Instance-Level Relationships

    Structure Inference Net: Object Detection Using Scene-Level Context and Instance-Level Relationships ...

  7. Learning-Python【5】:Python数据类型(1)—— 整型、浮点型、字符串

    一.整型 1.用途:记录年龄.等级.各种号码等 2.定义方式 age = 22 只能将纯数字的字符串转换成整型 3.常用操作+内置方法 赋值运算.比较运算.算数运算 该类型总结: 存一个值 不可变(可 ...

  8. Learning-Python【9】:Python文件操作

    1.什么是文件 文件是操作系统提供给用户或应用程序的一种虚拟单位,该虚拟单位直接映射的是硬盘空间.通俗点说,文件就是存放数据的地方 2.为何要处理文件 用户或应用程序直接操作文件(读/写)就被操作系统 ...

  9. jsp/servlet学习二之servlet详解

    Servlet API概览 Servlet API有一下四个java包: 1,javax.servlet,其中包含定义servlet和servlet容器之间契约的类和接口. 2,javax.servl ...

  10. sqlserver数据库中sql的使用

    目录: 1. 分组排序更新 2. 将查询结果插入到新的表中 3. 创建/更新存储过程 4. 创建/更新视图 5. 插入数据 6. 增加表格的列 7. 创建表格 8. 创建索引 9. 递归查询 1. 分 ...