在学习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. Shell-匹配FTP文件名

    想弄个脚本,下载每日构建的版本,由于版本文件名中有构建时间(不是固定值),只能按日期确认文件名,例如:project_name_2019-01-04*.exe 搜索了下,可以用dir filename ...

  2. 创建一个yum源,rpm安装二进制包

    作者:邓聪聪 安装mariadb vi /etc/yum.repos.d/mariadb.repo [mariadb]name=mariadbbaseurl=http://mirrors.neusof ...

  3. python操作三大主流数据库(13)python操作redis之新闻项目实战①新闻数据的导入

    1.新闻处理页面redis_news.py #coding:utf-8 import math import redis class RedisNews(object): def __init__(s ...

  4. 解决layui选中项下一页清空问题

    项目中遇到给用户在所有产品中匹配一部分产品.用layui 第一页选好之后到第二页再选,等回到第一页时之前选择的都没了,解决这个问题的办法如下: //勾选的产品id集合 var chooseAdids ...

  5. layui框架中关于table方法级渲染和自动化渲染之间的区别简单介绍

    方法级渲染: <table class="layui-hide" id="LAY_table_user" lay-filter="user&qu ...

  6. python-模块入门

    一.模块介绍 模块:模块就是一系列功能的集合体 模块有三种来源: 1.内置模块   2.第三方的模块   3.自定义模块 模块的格式: 1使用python编写的.py文件   2.已被编译为共享库或D ...

  7. bat如何实现自动创建文件夹(以当前时间命名)

    先比较直接的查看当前的日期和时间:(或者cmd中直接输入date,time查看) @echo off color 0a set dt=%date%%time% echo %dt% pause 1.使用 ...

  8. python - 发送带各种类型附件的邮件

    如何发送各种类型的附件. 基本思路就是,使用MIMEMultipart来标示这个邮件是多个部分组成的,然后attach各个部分.如果是附件,则add_header加入附件的声明. 在python中,M ...

  9. Netty简单聊天室

    1.创建maven项目,在pom.xml中引入netty的jar包 <project xmlns="http://maven.apache.org/POM/4.0.0" xm ...

  10. Android 基础 二 四大组件 Activity

    Activity Intent IntentFilter 一理论概述 一. Activity 用来提供一个能让用户操作并与之交互的界面. 1.1 启动 startActivity(Intent int ...