RuntimeError: The Session graph is empty. Add operations to the graph before calling run().
安装tensorflow后,进行测试
import tensorflow as tf
hello = tf.constant('hello,tensorflow!')
sess = tf.Session()
print(sess.run(hello))
但是发现有错误,因为版本问题,我的tensorflow版本是2.0.0,比较新
可以通过下面的方法查看tensorflow版本
所以第三句要改成
sess = tf.compat.v1.Session()
但是还是不行,又出现了另一个错误
但是,作为一个新手不太会改了,感觉是因为改成tf.compat.v1.Session()出的问题,然后print(sess.run(hello))不能输出。
所以只能用最原始的方法,降版本,先卸载
pip uninstall tensorflow
然后再用国内镜像源下载指定版本(速度快很多,直接用国外很慢而且容易失败),这是1.5版本的tensorflow,也可以根据个人需要来修改后面的数字
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow==1.5.0
然后等一会,安装成功后,再用回刚才的方法查看版本,已经是1.5.0了
然后测试tensorflow
我使用jupyter notebook来测试的,用终端cmd也可以
RuntimeError: The Session graph is empty. Add operations to the graph before calling run().相关推荐
- Machine Learning-based Selection of Graph Partitioning Strategy Using the Characteristics of Graph D
Machine Learning-based Selection of Graph Partitioning Strategy Using the Characteristics of Graph D ...
- 【论文笔记】Revisiting Graph based Collaborative Filtering: A Linear Residual Graph Convolutional Network
LR-GCCF 1. Abstract 2. Introduction 3. LR-GCCF 3.1 模型总体结构(Overall Structure of the Proposed Model) 3 ...
- Advances in Graph Neural Networks笔记4:Heterogeneous Graph Neural Networks
诸神缄默不语-个人CSDN博文目录 本书网址:https://link.springer.com/book/10.1007/978-3-031-16174-2 本文是本书第四章的学习笔记. 感觉这一章 ...
- AttributeError: module 'tensorflow' has no attribute 'Session'.解决办法
# 定义计算图 tens1 = tf.constant([1,2,3])# 创建一个会话 sess = tf.Session()# 使用这个创建好的会话来得到关心的运算的结果.比如可以调用 sess. ...
- 【深度学习】村通网之——谈谈Tensorflow Eager Execution机制之静态图和动态图的区别(一)
文章目录 前言 介绍 搭建静态图 搭建动态图 前言 随着TensorFlow 1.4 Eager Execution的出现,TensorFlow的使用出现了革命性的变化. 介绍 我很早就听说过这样一句 ...
- 常识——windows的tensorflow安装gpu版本,cuda算力只有3.0也可以
文章目录 问题 windows安装tensorflow_gpu版本 检查显卡是否支持cuda 查看自己的显卡型号 去官网查看是否支持cuda 检查显卡的cuda算力 按照GPU算力3.0的电脑配置进行 ...
- 测试TensorFlow 是否安装成功
Step1: import tensorflow as tf sess = tf.Session() a = tf.constant(1) b = tf.constant(2) print(sess. ...
- 安装tensorflow的时候出现了几个问题
安装tensorflow的时候出现了几个问题 1. import tensorflow as tf 报错信息: 2021-08-10 23:56:26.853798: W tensorflow/str ...
- module ‘tensorflow‘ has no attribute xxx tensorflow版本问题类导致API函数的报错
目录 1. module 'tensorflow' has no attribute 'Session' 2. The Session graph is empty. Add operations t ...
- Tensorflow的基本概念与常用函数
Tensorflow一些常用基本概念与函数(一) 1.tensorflow的基本运作 为了快速的熟悉TensorFlow编程,下面从一段简单的代码开始: import tensorflow as tf ...
最新文章
- 微信的Bug差点让我被老板炒鱿鱼!
- IDEA-Java自动生成单元测试
- Linux系统设置定时任务
- maven中使用junit老是找不到包
- 0119吧 iPhone 屏幕尺寸
- 思科网络基础配置命令大全(二)
- mysql提供的六种约束_SQL的六种约束
- 正则表达式获取body内容
- 概率潜在语义分析(pLSA) 相关知识
- 不同维度的矩阵相乘的时间复杂度
- 怎么在地图上画圆 php,SOSO地图API使用(一)在地图上画圆实现思路与代码
- Android未发现目标设备,Android设备不会显示为Unity3d调试的目标
- Golang的协程调度
- 中国摊铺机(车辆)市场趋势报告、技术动态创新及市场预测
- slickedit自定义代码片段
- linux centos用户修改密码,centos怎么修改用户密码
- 谷歌浏览器使用charles抓包localhost
- 音乐外链生成 html,音乐外链生成工具V2.1 支持14个音乐网站外链提取转换
- Pygame实现小球躲避实例代码
- 脑机接口中的流形嵌入知识迁移学习
热门文章
- Jdk(1.6和1.8)中英文Api文档
- Mac IDEA切换主题颜色
- 微信淘宝客小程序开发多多客京东客六合一系统外卖cps返利源码
- 【解决方案】PDF文字复制后乱码
- 通过高德地图api获取地点坐标(以查询物资点为例)
- 【Android 教程系列第 10 篇】史上最全的 Android 应用包名汇总,含主流应用商店包名,持续更新...
- 经典三层模型制作学校论坛系统(BBS)
- 商务统计_13 使用excel拟合曲趋势线
- 计算机思维导论第二讲答案,大学计算机计算思维导论第2讲习题及解析
- 大地坐标系是不是经纬度_批量导入经纬度点到奥维地图中