在学习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. boost常用库案例

    1.boost::any boost::any是一种通用的数据类型,可以将各种类型包装后统一放入容器内,最重要的它是类型安全的.有点象COM里面的variant. 使用方法: any::type()  ...

  2. linux学习之硬盘的存储原理和内部架构

    原文地址:https://blog.csdn.net/tanggao1314/article/details/52074735 首先,让我们看一下硬盘的发展史: 1956年9月13日,IBM的IBM ...

  3. P3830 [SHOI2012]随机树 题解

    P3830 随机树 坑题,别人的题解我看了一个下午没一个看得懂的,我还是太弱了. 题目链接 P3830 [SHOI2012]随机树 题目描述 输入输出格式 输入格式: 输入仅有一行,包含两个正整数 q ...

  4. ACM Computer Factory POJ - 3436 网络流拆点+路径还原

    http://poj.org/problem?id=3436 每台电脑有$p$个组成部分,有$n$个工厂加工电脑. 每个工厂对于进入工厂的半成品的每个组成部分都有要求,由$p$个数字描述,0代表这个部 ...

  5. DbProviderFactory

    背景 在此之前,我一直以为调用哪个数据库就要用它专门的链接,除非是odbc方式.后来用了java,想.net怎么没有通用的链接呢,尤其是oracle,还要装他的客户端,如此不方便竟然能流行起来.后来知 ...

  6. Chromium Embedded Framework (CEF)_3.2171.1979_v20170602_x86.tar.xz

    CEF 为观看各个直播平台而特此修改的浏览器 可以单独提取 Flash 视频, 并可以修改视频的大小等功能 这次修改是主要针对 YY web 直播平台 对录屏的朋友有很大帮组 CEF_3.2171.1 ...

  7. LINUX-redis & mongodb

    ubuntu安装redis: apt-get -y install redis-serverubuntu启动redis: /etc/init.d/redis-server restart linux安 ...

  8. 死磕安卓前序:MVP架构探究之旅—基础篇

    前言 了解相关更多技术,可参考<我就死磕安卓了,怎么了?>,接下来谈一谈我们来学习一下MVP的基本认识. 大家对MVC的架构模式再熟悉不过.今天我们就学习一下MVP架构模式. MVC和MV ...

  9. ( linker command failed with exit code 1) 错误解决方案 项目使用的是pod

    targets -> build settings -> architectures -> build active architecture only -> debug 改成 ...

  10. LeetCode(112):路径总和

    Easy! 题目描述: 给定一个二叉树和一个目标和,判断该树中是否存在根节点到叶子节点的路径,这条路径上所有节点值相加等于目标和. 说明: 叶子节点是指没有子节点的节点. 示例: 给定如下二叉树,以及 ...