当前位置:网站首页>解决ValueError: Argument must be a dense tensor: 0 - got shape [198602], but wanted [198602, 16].
解决ValueError: Argument must be a dense tensor: 0 - got shape [198602], but wanted [198602, 16].
2022-04-23 04:43:00 【小高高不要bug】
在Tensorflow中调用tf.data.Dataset.from_generator(generator_function,args=(values1,values2))(generator_function是自定义的生成器函数,args是生成器的输入参数) 时报出这个错误,找了一晚上,它实际是在这个位置报出的错误:

在tensor_util.py里的make_tensor_proto()函数的如下位置:

其中图片中的nparray = np.array(values, dtype=np_dt),这个values是生成器的输入参数values1,values2(有多少个参数会做多少次判断,values=values1,values=values2),上图中 _GetDenseDimensions(values) 函数的定义如下:

通过前后分析就可以发现,这个args里面的参数不能是列表的列表,可以是列表,也可以是字符串等,但是一旦是列表里面包含列表的参数就会报错。
版权声明
本文为[小高高不要bug]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_46702604/article/details/124333256
边栏推荐
猜你喜欢

229. 求众数 II

The 14th issue of HMS core discovery reviews the long article | enjoy the silky clip and release the creativity of the video

Spark small case - RDD, spark SQL

Key points of AWS eks deployment and differences between console and eksctl creation

QML advanced (V) - realize all kinds of cool special effects through particle simulation system

Microbial neuroimmune axis -- the hope of prevention and treatment of cardiovascular diseases

Coinbase: basic knowledge, facts and statistics about cross chain bridge

Experience summary and sharing of the first prize of 2021 National Mathematical Modeling Competition

Recommended scheme for national production of electronic components for wireless charging

Apache Bench(ab 压力测试工具)的安装与使用
随机推荐
Detailed explanation of life cycle component of jetpack
Luogu p1858 [multi person knapsack] (knapsack seeking the top k optimal solution)
zynq平台交叉编译器的安装
RC低通滤波器的逆系统
The last day of 2021 is the year of harvest.
AWS EKS 部署要点以及控制台与eksctl创建的差异
leetcode001--返回和为target的数组元素的下标
做数据可视化应该避免的8个误区
Fusobacterium -- symbiotic bacteria, opportunistic bacteria, oncobacterium
华为机试--高精度整数加法
QML advanced (V) - realize all kinds of cool special effects through particle simulation system
Chapter 4 - understanding standard equipment documents, filters and pipelines
leetcode005--原地删除数组中的重复元素
Simply drag objects to the item bar
Code007 -- determine whether the string in parentheses matches
QML advanced (IV) - drawing custom controls
MySQL - data read / write separation, multi instance
Innovative practice of short video content understanding and generation technology in meituan
程序员抱怨:1万2的工资我真的活不下去了,网友:我3千咋说
Leetcode009 -- search the target value in the array with binary search