VisibleDeprecationWarning , Creating an ndarray from ragged nested sequences... 警告怎么办?
我不是完美主义,但是至少,我在做实验的时候不能容忍有 warning 的出现。
今天使用 tensorflow.keras.datasets中的 imdb 数据集,使用 imdb.load_data() 方法导入数据的时候,报出一个警告,VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
经过查阅,得知这是因为创建 numpy包中 ndarray 类对象时,设若 np.array( some_object),如果传入的参数 some_object 是个 ragged 的,或者维度不整齐,或者每维元素数量不固定的,那么就会报出这个 warning。
这不是自己写的代码有问题,而是人家写好的代码模块有问题(现在能 被 numpy 兼容,以后会被弃置的)。所以可以修改人家写好的 imdb.load_data 的代码。
方法。
先 import warings, 然后 warnings.simplefilter("error"),使得 warning 不会通过检查,报出warning位置,找到了关于创建 ndarray 的代码,这就在imdb.load_data 方法内部
和
一共两处,
分别做如下修改:
然后就没有 warning 了。
---------------------------------------------------------------------------------------
Conclusion
---------------------------------------------------------------------------------
哇,第一次改人家的库,虽然并不是底层的库,也是很爽。我 cao 勇 的(ww腔)~~
Above all, 浪费了很多的时间,只为了不见个warning,感觉很亏。
还是要抓主要矛盾,下次一定。 :)
VisibleDeprecationWarning , Creating an ndarray from ragged nested sequences... 警告怎么办?相关推荐
- Python学习:问题 VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a
遇到的问题:在pycharm中运行数组运算,出现警告 VisibleDeprecationWarning: Creating an ndarray from ragged nested sequenc ...
- VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tupl ...
- VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tupl
构造一个多维数组时,出现问题: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which i ...
- numpy之 警告VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
目录 警告 解决 警告 这是我写的读取npz文件的代码, datas = np.load("bsm.npz", allow_pickle=True) print(datas.fil ...
- 【Bug解决】VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
问题描述 VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or ...
- python报错 VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
python报错 VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences 报错原因:numpy中元素sh ...
- python numpy报错:VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
注意:标题中说是"报错",但是这事实上只是"警告".表依然可以正常导出. 今天遇到了这个问题,查到了这篇博文:https://blog.csdn.net/Aug ...
- 【Bug修复】VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
问题描述: 在通过array()函数创建numpy数组时,因为array()函数是可以直接传入已有数据类型,所以,就直接使用dtype去查看类型,此时出现了一个警告. 代码: import numpy ...
- Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or nda
python报错 VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a lis ...
最新文章
- 使用git帮助多人开发
- 主表关联字表,主表自增长,同时插入
- Spring事务传递性探讨
- 洛谷2296 寻找道路
- qimage加载bmp图片_9个最佳的优化动态gif图片大小的工具
- java-不用辅助变量,两变量直接交换
- 鸿蒙内部测试情况,鸿蒙OS内测曝光,安卓劲敌浮出水面!
- Mysql的limit用法
- Tensorflow2.0数据和部署(三)——基于Tensorflow数据服务的数据管道
- Spring Boot 集成 Spring Security 实现权限认证模块
- 深度学习——(4)VGG16 图像分类
- 电阻(1)电阻种类篇
- Java总结一:初窥线程
- 让你的工作变轻松的一套免费的 iPhone 手势图标
- [A133 Android11] 连接pc板子掉电
- java clh_CLH锁学习
- ICWPT 2022 | 从技术突破到生态构建,小米坚持做充电领域的拓荒者和领先者
- Redis(4)优惠券秒杀
- 简述docx文档格式-CTF竞赛专用
- Android_10开发京东商城手机客户端的几点非技术性总结
热门文章
- 影评《死亡邮件》奇葩国产欢乐多
- Soft:Eric软件界面的简介、案例应用之详细攻略
- 区块链合约协议C语言,Nervos CKB将支持多语言编写智能合约
- shared nothing架构
- 2024年天津农学院专升本拟招生专业及停招酒店管理、市场营销通知
- Fantasy Mix-Lingual Tacotron Version 4: Google-ZYX-Phoneme-HCSI-DBMIX
- 机敏问答[复变][4] #20210627
- Ubuntu常用命令大全(zhuan)
- System 命名空间
- uin-app中组件的引用