tensorflow官方文档中的sub 和mul中的函数已经在API中改名了
在照着tensorflow 官方文档和极客学院中tensorflow中文文档学习tensorflow时,遇到下面的两个问题:
1)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])
#使用初始化器initalizer op的run()方法初始化'x'
x.initializer.run()
#增加一个减法sub op, 从'x'减去'a',运行减去op,输出结果
sub = tf.sub(x,a)
print(sub.eval())
# 任务完成,关闭回话
sess.close()
执行时报错:
Traceback (most recent call last):
File "C:/PythonProj/tensorflow/first_tensorflow.py", line 43, in <module>
sub = tf.sub(x,a)
AttributeError: module 'tensorflow' has no attribute 'sub'
经过在pycharm中tf.自动反显的信息,我发现原来这个sub函数已经被subtract代替了,换成tf.subtract(x,a) ,ok ,一切顺利!
2)AttributeError: module 'tensorflow' has no attribute 'mul'
input1 = tf.constant(3.0)
input2 = tf.constant(2.0)
input3 = tf.constant(5.0) intermed = tf.add(input2,input3)
mul = tf.mul(input1,intermed)
with tf.Session() as sess:
result = sess.run([mul,intermed])
print(result)
报错信息为:
Traceback (most recent call last):
File "C:/PythonProj/tensorflow/first_tensorflow.py", line 78, in <module>
mul = tf.mul(input1,intermed)
AttributeError: module 'tensorflow' has no attribute 'mul'
同理,经过在pycharm中tf.反显信息的观察,我发现原来这个tf.mul函数已经被换成了tf.multiply了,修改后,ok!
tensorflow官方文档中的sub 和mul中的函数已经在API中改名了的更多相关文章
- 人工智能系统Google开源的TensorFlow官方文档中文版
人工智能系统Google开源的TensorFlow官方文档中文版 2015年11月9日,Google发布人工智能系统TensorFlow并宣布开源,机器学习作为人工智能的一种类型,可以让软件根据大量的 ...
- TensorFlow官方文档
关于<TensorFlow官方文档> <TensorFlow官方文档>原文地址:http://devdocs.io/tensorflow~python/ ,本次经过W3Csch ...
- TensorFlow 官方文档中文版【转】
转自:http://wiki.jikexueyuan.com/project/tensorflow-zh/ TensorFlow 官方文档中文版 你正在阅读的项目可能会比 Android 系统更加深远 ...
- TensorFlow 官方文档中文版
http://wiki.jikexueyuan.com/list/deep-learning/ TensorFlow 官方文档中文版 你正在阅读的项目可能会比 Android 系统更加深远地影响着世界 ...
- TensorFlow 官方文档中文版 --技术文档
1.文档预览 2.文档下载 TensorFlow官方文档中文版-v1.2.pdf 提取码:pt7p
- TensorFlow 官方文档中文版学习
TensorFlow 官方文档中文版 地址:http://wiki.jikexueyuan.com/project/tensorflow-zh/
- 在 Ubuntu 上安装 TensorFlow (官方文档的翻译)
本指南介绍了如何在 Ubuntu 上安装 TensorFlow.这些指令也可能对其他 Linux 变体起作用, 但是我们只在Ubuntu 14.04 或更高版本上测试了(我们只支持) 这些指令. 一 ...
- 【TensorFlow官方文档】MNIST机器学习入门
MNIST是一个入门级的计算机视觉数据集,它包含各种手写数字图片:它也包含每一张图片对应的标签,告诉我们这个是数字几.比如,下面这四张图片的标签分别是5,0,4,1. 从一个很简单的数学模型开始:训练 ...
- TensorFlow 官方文档 Programmer's Guide 中文翻译 —— 引言
TensorFlow Programmer's Guide (Introduction) TensorFlow 编程手册 (引言) #(本项目对tensorflow官网上给出的指导手册(TF1.3版本 ...
随机推荐
- Rhythmbox音乐播放器常见问题
一.歌名中文乱码 对于所有用gstreamer做后端的播放器,如Rhythmbox, 设置如下的环境变量后即可正确读取mp3中GBK编码的id3 tag. export GST_ID3_TAG_ENC ...
- Hibernate入门(一)
一 Hibernate介绍 Hibernate 是一个开源.轻量级的ORM(对象关系映射)工具,该工具简化了数据创建.数据处理和数据访问,它是一种将对象映射到数据库中表的编程技术.ORM工具内部使用J ...
- 关于java中使用数组的几点理解笔记
1.数组元素就是变量: 2.在已有数据类型之后加方括号[],就会产生一个新的数组类型: 分两类:1)基本数据类型,如:int[],string[]; 2)引用数据类型,如:Person[](类): 3 ...
- JavaScript事件(二)
例题顺序: 1.子菜单下拉2.图片轮播3.选项卡效果4.进度条制作5.滑动效果6.滚动固定效果 1.子菜单下拉 <!DOCTYPE html PUBLIC "-//W3C//DTD X ...
- JS添加类似C# string.Format方法
String.prototype.format=function() { if(arguments.length==0) return this; for(var s=this, ...
- 一篇文章让你搞懂 SSL 证书
关于结婚这件事 那天和同事讨论到底什么才算是真正的「结婚」?这种话题本来是极其不应该存在的.传统意义的领个证书,办个婚礼.吃吃喝喝,但随着社会各族人民身心发展进化,原本那些繁琐流程简直是反人类,貌似现 ...
- windows下python连接oracle数据库
1.首先安装cx_Oracle包2.解压instantclient-basic-windows.x64-11.2.0.4.0.zip到c:\oracle3.拷贝instantclient_11_2下所 ...
- 【LeetCode】190. Reverse Bits
题目: Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented ...
- 【Android Developers Training】 28. 将用户带领到另一个应用
注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...
- 改变图像,运用match方法判断
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>菜鸟 ...