'tensorflow' has no attribute 'sub'

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

# 进入一个交互式 TensorFlow 会话.
import tensorflow as tf
sess = tf.InteractiveSession()x = tf.Variable([1.0, 2.0])
a = tf.constant([3.0, 3.0])# 使用初始化器 initializer op 的 run() 方法初始化 'x'
x.initializer.run()# 增加一个减法 sub op, 从 'x' 减去 'a'. 运行减法 op, 输出结果
sub = tf.sub(x, a)
print sub.eval()
# ==> [-2. -1.]
AttributeError: module 'tensorflow' has no attribute 'sub'

估计是函数换名字了,果然换成 subtract 就可以了。

'tensorflow' has no attribute 'sub'相关推荐

  1. AttributeError: module ‘tensorflow‘ has no attribute ‘Session‘错误解决

    AttributeError: module 'tensorflow' has no attribute 'Session'错误解决 根据网上教程安装tensorflow环境时,最后都会有个测试代码用 ...

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

    执行<TensorFlow实战Google深度学习框架(第2版)>only源代码 CH3 时如下语句报错 batch_size = 8 w1= tf.Variable(tf.random_ ...

  3. tf2.0环境下“module ‘tensorflow‘ has no attribute ‘log‘”的解决办法

    写在这里的初衷,一是备忘,二是希望得到高人指点,三是希望能遇到志同道合的朋友. 目录 一.问题 二.根本原因 三.解决办法 方法一 方法二 一.问题 目前,尝试着通过tensorflow对医学图像进行 ...

  4. 问题解决——AttributeError: module ‘tensorflow‘ has no attribute ‘placeholder‘

    问题解决--AttributeError: module 'tensorflow' has no attribute 'placeholder' 参考文章: (1)问题解决--AttributeErr ...

  5. 问题:AttributeError: module 'tensorflow' has no attribute 'gfile'

    目录 问题 原因与解决方案 解决方案1 解决方案2 问题 运行如下代码 if not tf.gfile.exists(DATA_DIRECTORY):tf.gfile.makedirs(DATA_DI ...

  6. module ‘tensorflow‘ has no attribute ‘Tensor‘

    module 'tensorflow' has no attribute 'Tensor' import tensorflow as tftf.compat.v1.Session()from typi ...

  7. module 'tensorflow' has no attribute 'Session'

    AttributeError: module 'tensorflow' has no attribute 'Session'错误解决 原创陆羽飞 最后发布于2019-10-07 13:32:07 阅读 ...

  8. keras module 'tensorflow' has no attribute 'placeholder'

    keras module 'tensorflow' has no attribute 'placeholder' pip install tensorflow-gpu==1.13.1 keras=2. ...

  9. tensorflow版本问题导致的错误AttributeError: module ‘tensorflow‘ has no attribute ‘***‘

    问题解决--AttributeError: module 'tensorflow' has no attribute 'placeholder' - yuanyuanWu11 - 博客园 tensor ...

  10. 成功解决AttributeError: module ‘tensorflow‘ has no attribute ‘placeholder‘

    成功解决AttributeError: module 'tensorflow' has no attribute 'placeholder' 目录 解决问题 解决思路 解决方法 T1.降低tensor ...

最新文章

  1. KS103超声波测距模块
  2. ELK 性能优化实践
  3. poj2409(纯Polya定理)
  4. 模板 - 数学 - 数论 - 莫比乌斯反演 - 2
  5. 【数据结构与算法】之有关“跳跃游戏”的求解思路与示例算法
  6. java-初识JVM的内存分配(5个区域)概念--系列(一)
  7. Bash字符串处理(与Java对照) - 17.判断是否以另外的字符串结尾
  8. github 国内加速镜像
  9. Intel Haswell/Broadwell架构/微架构/流水线 (3)-流水线乱序引擎
  10. java 输出一个爱心_java基础 之 几个常用的类
  11. jQuery--checkbox全选/取消全选 及checkbox遍历
  12. android开机自动打开微信小程序,Android应用启动微信小程序
  13. 计算机应用免费课件,计算机应用基础ppt课件 免费版
  14. 多尺度卷积稀疏编码的无监督迁移学习
  15. ios safari 模拟器_iOS 模拟器调试大法了解一下?
  16. php 同比增长率上期未0,同比增长率计算时,上期值为0怎么计算?
  17. IPhone 日历提醒
  18. windows系统清除电脑地址栏文件(夹)路径
  19. Java面试集合(四)
  20. 那些好玩的生成器网站(二)

热门文章

  1. oracle—“操作记录已被里一个用户锁住” 解决办法
  2. mysql(5.6及以下)解析json
  3. (二) Keras 非线性回归
  4. Android 返回键的处理
  5. SQLite学习和使用
  6. 可用的免费公开的DNS
  7. 使用指针时的“陷阱”
  8. 「洛谷P2397」 yyy loves Maths VI (mode) 解题报告
  9. 九眼合同智能审核系统运用NLPIR大数据技术进行核查
  10. java RMI 笔记