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版本 ...
随机推荐
- ionic3 环境配置 + 運行第一個項目
1.首先我們先下載個 nodejs安裝包 地址:https://nodejs.org/en/ 安裝 檢查是否安裝成功,打開命令提示符 輸入 node -v 回車 查看版本 結果: 2.安裝ionic ...
- WKWebView 官方文档
WKWebView 类 一个WKWebView对象可以显示交互式的web内容.就像一个应用程序的浏览器.你可以使用WKWebView类嵌入Web内容的应用程序.这样做,创造一个WKWebView对象, ...
- jrebel配置热部署参数
jrebel配置热部署参数: -noverify -agentpath:D:/jrebel/lib/jrebel64.dll -Drebel.dirs=E:/workspace/item/src/ma ...
- thinkphp中fetch渲染模板的处理
<script type="text/javascript"> function xiugai(elm){ var formData1=$("#a1_&quo ...
- 【Android Developers Training】 98. 获取联系人列表
注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...
- JAVA基础——类和对象
java类与对象学习笔记 一.成员变量和局部变量 (1)定义 1.成员变量 在类中定义,用来描述对象将要有什么.(默认的成员变量值为0) 2.局部变量 在类的方法中定义,在方法中临时保存数据. 演示示 ...
- css实现居中的五中方法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- C++基础之引用与指针的区别与联系、常引用使用时应注意的问题
什么是引用? 引用就是对变量起一个别名,而变量还是原来的变量,并没有重新定义一个变量.例如下面的例子: #include<iostream> using namespace std; ...
- 【原创】无线破解Aircrack-ng套件详解--airmon-ng与airodump-ng
一:Aircrack-ng详解 1.1 Aircrack-ng概述 Aircrack-ng是一款用于破解无线802.11WEP及WPA-PSK加密的工具,该工具在2005年11月之前名字是Aircra ...
- PeopleCode事件和方法只用于online界面不能用于组件接口(component interface)
在使用CI过程中,哪些方法是不能使用的.以下为PeopleBook解释的内容. 一.搜索框代码不执行:SearchInit, SearchSave, and RowSelect events 意味着使 ...