tf2.0环境下“module ‘tensorflow‘ has no attribute ‘log‘”的解决办法
写在这里的初衷,一是备忘,二是希望得到高人指点,三是希望能遇到志同道合的朋友。
目录
- 一、问题
- 二、根本原因
- 三、解决办法
- 方法一
- 方法二
一、问题
目前,尝试着通过tensorflow对医学图像进行处理,运行代码,出现的错误如下
_categorical_crossentropyreturn - tf.reduce_sum(target * tf.log(output), axis)
AttributeError: module 'tensorflow' has no attribute 'log'
二、根本原因
错误翻译:AttributeError: 模块“tensorflow”没有属性“log”
三、解决办法
方法一
如果是2.0的版本请修改为更低的版本试试,比如1.4或者以下版本
方法二
tf.log 改为:tf.math.log
return - tf.reduce_sum(target * tf.log(output), axis)return - tf.reduce_sum(target * tf.math.log(output), axis)
以上是自己通过网络查找及自身实践整理所得,大家有更好的建议,可以留言交流!
转载或者引用本文内容请注明来源及原作者
参考
AttributeError: module ‘tensorflow’ has no attribute ‘log’
tf2.0环境下“module ‘tensorflow‘ has no attribute ‘log‘”的解决办法相关推荐
- .net framework 4.0环境下遇到版本不同编译不通过的解决办法
本文内容: 1.问题引出 2.问题解决 3.原因分析 最近部门的开发环境都更新到了WIN7+.NET framework4+VS2010上,在体验新技术和新环境带给我们提高效率的方式方法的同时也带来了 ...
- AttributeError: module ‘tensorflow‘ has no attribute ‘Session‘错误解决
AttributeError: module 'tensorflow' has no attribute 'Session'错误解决 根据网上教程安装tensorflow环境时,最后都会有个测试代码用 ...
- Win10环境下,word2016嵌入mathtype出现灰色的解决办法
Win10环境下,word2016嵌入mathtype出现灰色的解决办法,亲测好使: https://blog.csdn.net/qq_33066729/article/details/8095392 ...
- tensorflow2.0及以上版本在使用Session模块时报错:AttributeError: module ‘tensorflow‘ has no attribute ‘Session‘ 已解决
tensorflow2.0版本及之后的版本在使用Session模块时报错:AttributeError: module 'tensorflow' has no attribute 'Session' ...
- AttributeError: module 'tensorflow' has no attribute 'Session'错误解决
Ubuntu刚安装好Tensorflow以后运行 import tensorflow as tf tf.Session() 报错AttributeError: module 'tensorflow' ...
- wordcloud python3.6能用吗_Python3.6环境下安装wordcloud模块遇到的问题及解决办法
"error: Microsoft Visual C++ 14.0 is required-"问题解决 今天在Python 3.6环境中,制作词云,需要安装wordcloud模块, ...
- Windows环境下个别Gem包安装不上的解决办法
在Windows环境下,安装Gem包:therubyracer时对libv8包有所依赖, 先安装libv8的时候报错: 解决:注释掉 gem therubyracer 原因: "No, th ...
- python脚本AttributeError: module 'xxxx' has no attribute 'xxxxx'错误解决办法
最近写脚本发现了这样的一个错误,脚本.环境什么的完全正确,但执行的时候却报错:AttributeError: module 'xxxx' has no attribute 'xxxxx',查阅了一些相 ...
- 黑金开发板在NiosII环境下烧写image到flash失败的解决办法
网上看到很多朋友和我遇到一样的问题,貌似都没有解决,所以在此记录下. 背景:1.利用QuartusII与NiosII EDS软件进行软硬件开发: 2.硬件:黑金开发板AX301, 3.软件:led流水 ...
最新文章
- 很简单却很实用的强拉脚本
- python绘制可多角度查看的3d图像
- 科大星云诗社动态20220103
- geometry-api-java 学习笔记(七)拓扑运算之cut
- 虚拟机里面安装Openfiler 2.99
- A Quantization-Friendly Separable Convolution for MobileNets
- 情报领域因果推理智能项目概览:以DAPAR为例
- 第一部分 线性表的链式存储(三)--静态链表
- 3.5 tensorflow2实现样本分布K-S检验 ——python实战
- 【JAVA】什么时候会发生空指针异常
- Mac 安装 MySQL 教程
- 高级操作系统——Nachos同步机制
- VBA批量OCR识别提取身份证照片信息_OCR车牌识别系统实现停车场智能停车管理
- 修改Fedora 18的窗口背景颜色为浅绿色
- linux grep命令要查找的内容有双引号
- 谁先量子计算机谁就,G、IBM、中科院,比一比谁先实现量子计算霸权?
- soj115 御坂网络
- 《信息化项目文档模板四——系统建设方案模板》
- 《自拍教程40》Python adb一键导出Log
- DXO 做了哪些测试?
热门文章
- Linux vim 中文显示乱码解决方法
- 三种方式实现自定义圆形进度条ProgressBar
- 从「王师傅一共损失了多少钱」说开去
- 新手理解之NHibernate是什么?
- keytool生成证书_创建自签名ssl证书,Java生产jks证书
- 2019中南大学考研计算机考试,中南大学2019年全国硕士研究生入学考试《计算机网络》考.PDF...
- python书籍_python书籍购买建议
- mysql建立数据浏览器_一个简单的MySQL数据浏览器
- 低头是家和月光,抬头是车和远方
- 为什么使用RLC表测量电感在不同的频率测量值不同呢?