AttributeError: module 'tensorflow' has no attribute 'sub'
官方的例子:运行之后出现以下错误
# 进入一个交互式 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.]
Traceback (most recent call last):File "C:\Users\lzm\Desktop\ten-1.py", line 10, in <module>sub = tf.sub(x, a) AttributeError: module 'tensorflow' has no attribute 'sub'
出现这个问题是因为sub函数换名字了,换成了subtract
# 进入一个交互式 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.subtract(x, a) print sub.eval() # ==> [-2. -1.]
转载于:https://www.cnblogs.com/QW-lzm/p/10499013.html
AttributeError: module 'tensorflow' has no attribute 'sub'相关推荐
- AttributeError: module ‘tensorflow‘ has no attribute ‘Session‘错误解决
AttributeError: module 'tensorflow' has no attribute 'Session'错误解决 根据网上教程安装tensorflow环境时,最后都会有个测试代码用 ...
- AttributeError: module 'tensorflow' has no attribute 'random_normal'
执行<TensorFlow实战Google深度学习框架(第2版)>only源代码 CH3 时如下语句报错 batch_size = 8 w1= tf.Variable(tf.random_ ...
- 问题解决——AttributeError: module ‘tensorflow‘ has no attribute ‘placeholder‘
问题解决--AttributeError: module 'tensorflow' has no attribute 'placeholder' 参考文章: (1)问题解决--AttributeErr ...
- 问题:AttributeError: module 'tensorflow' has no attribute 'gfile'
目录 问题 原因与解决方案 解决方案1 解决方案2 问题 运行如下代码 if not tf.gfile.exists(DATA_DIRECTORY):tf.gfile.makedirs(DATA_DI ...
- tensorflow版本问题导致的错误AttributeError: module ‘tensorflow‘ has no attribute ‘***‘
问题解决--AttributeError: module 'tensorflow' has no attribute 'placeholder' - yuanyuanWu11 - 博客园 tensor ...
- 成功解决AttributeError: module ‘tensorflow‘ has no attribute ‘placeholder‘
成功解决AttributeError: module 'tensorflow' has no attribute 'placeholder' 目录 解决问题 解决思路 解决方法 T1.降低tensor ...
- 成功解决AttributeError: module ‘tensorflow‘ has no attribute ‘contrib‘
成功解决AttributeError: module 'tensorflow' has no attribute 'contrib' 目录 解决问题 解决思路 解决方法 解决方法
- 成功解决AttributeError: module ‘tensorflow‘ has no attribute ‘get_variable‘
成功解决AttributeError: module 'tensorflow' has no attribute 'get_variable' 目录 解决问题 解决思路 解决方法 解决问题 Attri ...
- 成功解决AttributeError: module tensorflow has no attribute placeholder
成功解决AttributeError: module 'tensorflow' has no attribute 'placeholder' 目录 解决问题 解决思路 解决方法 解决问题 Attrib ...
- 成功解决AttributeError: module tensorflow has no attribute random_normal
成功解决AttributeError: module 'tensorflow' has no attribute 'random_normal' 目录 解决问题 解决思路 解决方法 解决问题 Attr ...
最新文章
- c++顺序容器vector用法
- CLR Via C# 3rd 阅读摘要 -- Chapter 24 – Runtime Serialization
- 3D 服务器端以向量计算为主的角色位置的算法
- 数据库3(DBUtils)
- UVa1588 | 算法竞赛入门经典(第二版) 习题3-11 换低档装置
- 使用 cx recipe 安装 Hybris Commerce Cloud 之后,遇到 indexer workder failed 错误
- c语言各种变量的优缺点,C语言优缺点
- visio 导出无边距的pdf 图
- 生物大数据时代,如何做好数据管理和再利用,发IF10+的数据库文章?
- 动态ip如何做域名解析?
- C++中lib和dll解析
- 突击计划——银行利息
- xsd 生成 java 类_如何从Java类生成XSD
- 模型退火的投资组合优化
- 挑netfilter的11个不足之处
- 波音737-800座位图哪个好_留学生坐飞机出国千万别选这些座位!航空公司不会告诉你的选座秘密........
- android W F 密码,这几种Android图形密码最常用 你也在用吗?
- 如何进行业务需求分析
- 区块链3.0 EOS和TRON
- 开放正成为华为下一阶段的战略竞争力