在学习tensorflow的时候,照到官方的例子做,发现了一个

Traceback (most recent call last):
File "interactive.py", line , in <module>
sub = tf.sub(x,a)
AttributeError: module 'tensorflow' has no attribute 'sub'

一猜,我就估计是函数换名字了,果然,换成了subtract 这样就坑过了

# -*- coding: utf-8 -*-
import tensorflow as tf
sess = tf.InteractiveSession() x = tf.Variable([1.0, 2.0])
a = tf.constant([3.0, 3.0]) x.initializer.run() sub = tf.subtract(x,a)
print(sub.eval())

'tensorflow' has no attribute 'sub'的更多相关文章

  1. AttributeError: module 'tensorflow' has no attribute 'enable_eager_execution'

    Traceback (most recent call last): File "linear_regression_eager_api.py", line 15, in < ...

  2. AttributeError: module 'tensorflow' has no attribute 'sub'

    官方的例子:运行之后出现以下错误 # 进入一个交互式 TensorFlow 会话. import tensorflow as tf sess = tf.InteractiveSession() x = ...

  3. AttributeError: module 'tensorflow' has no attribute 'Session'

      版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/qq_33440324/article/ ...

  4. python,keras,tensorflow安装问题 module 'tensorflow' has no attribute 'get_default_graph'

    module ‘tensorflow’ has no attribute ‘get_default_graph’当我使用keras和tensorflow做深度学习的时候,python3.7报了这个错误 ...

  5. python3 ,AttributeError: module 'tensorflow' has no attribute 'merge_summary'

    error:tensorflow有些方法属性被改了, self.summary_writer = tf.train.SummaryWriter(summary_dir)改为:summary.FileW ...

  6. TensorFlow——module 'tensorflow' has no attribute 'xxx'

    tf.sub()更改为tf.subtract() tf.mul()更改为tf.multiply() tf.types.float32更改为tf.float32 tf.pact()更改为tf.stact ...

  7. AttributeError: module 'tensorflow' has no attribute 'set_random_seed'

    anaconda3 python3.7 安装好tensorflow 后出现上面的问题,原因是安装的tensorflow版本是2.0的,所以使用以前的代码tensorflow中的函数不兼容.

  8. 吴裕雄--天生自然 pythonTensorFlow图形数据处理:解决module 'tensorflow' has no attribute 'Session'

    原因:因为是tensorflow 2.0版本

  9. 吴裕雄--天生自然python TensorFlow图片数据处理:解决TensorFlow2.0 module ‘tensorflow’ has no attribute ‘python_io’

    tf.python_io出错 TensorFlow 2.0 中使用 Python_io 暂时使用如下指令: tf.compat.v1.python_io.TFRecordWriter(filename ...

随机推荐

  1. python3-深浅copy

    转载:https://www.cnblogs.com/ctztake/p/8194275.html 术语 变量:是一个系统表的元素,拥有指向对象的连接空间. 对象:被分配的一块内存,存储其所代表的值. ...

  2. pt-table-sync同步报错Called not_in_left in state 0 at /usr/bin/pt-table-sync line 5231【原创】

    试验环境MySQL5.7.19,自己使用pt-table-sync 3.0.2版本同步后,手动在从库执行后,在用pt-table-sync验证时报错 命令如下: pt-table-,u=用户名,p=, ...

  3. 效率较高的php下读取文本文件的代码

    主要用下面这两个方法fread和 fgets的区别大家需要注意下     fread :以字节位计算长度,按照指定的长度和次数读取数据,遇到结尾或完成指定长度读取后停止.  fgets :整行读取,遇 ...

  4. Control算法相关

    Control算法相关 添加新的control算法官方指导教程. 创建一个控制器: 在文件control_config中添加新控制器的配置信息: 注册新控制器. 如何添加新的CAN卡. Apollo中 ...

  5. page.isvalid

    背景 看到这个标题,想了半天,为啥用的.应该是当初前台要动态增加行这个事情,当初用.net真是用傻了,竟然对html.aspx原理不大清楚,对于html也想着后台生成.真是弱智啊.谈到这里,想到c#这 ...

  6. GridView的stretchMode属性

    stretchMode属性值的作用是设置GridView中的条目以什么缩放模式去填充剩余空间.参数stretchMode 可选值为:none,spacingWidth,columnWidth, spa ...

  7. 表单,table的css

    table{table_layout:fixed;border-collapse: collapse;border-spacing: 0}border-collapse: collapse 边框合并在 ...

  8. LuoGu P2002 消息扩散

    题目传送门 这个题其实就是tarjan缩点的板子题对吧....至少我是这么想的 首先这是个有向图,对于一个有向图,我们肯定要考虑环的存在与否,恰好这个题又是让我们找出最少的点,使得这几个点能够走遍全图 ...

  9. Java位运算符浅析

    在学习源码中,发现有大量使用位运算符,这样做的目的是为了节约内存开销和加快计算效率. 位运算符,这个”位”代表这什么? 位:二进制位简称“位”,是二进制记数系统中表示小于2的整数的符号,一般用1或 0 ...

  10. Confluence 6 Oracle 连接问题解决

    如果 Confluence 提示没有 class 文件,你可能将你的 JDBC 驱动放置到了错误的文件夹. 下面的页面包含了一些你在使用 Oracle 数据库连接的时候可能会遇到的常见问题,请参考: ...