ValueError: setting an array element with a sequence问题主要有几种以下的情况:
- 输入到模型里的数据没严格转换成 np.arry()形式,
- 矩阵没对齐,个别行成员数量与其他不一致,不如0的缺省等。
- 数据dtype不对或者说不一致,应该统一成 np.float64, int或者其他。
如
feeds = {
sbl.input_x1: x1_train_batch,
sbl.input_x2: x2_train_batch,
sbl.input_y: y_train_batch,
sbl.dropout_keep_prob: FLAGS.dropout_keep_prob
}
字典中,x1_train_batch
和 x2_train_batch
的维度不一样
又如:
np.array([1,2,3,[4,5,6]])
ValueError: setting an array element with a sequence.
- 参考文献
ValueError: setting an array element with a sequence问题解决思路_人工智能_Poo_Chai的博客-CSDN博客
https://blog.csdn.net/Poo_Chai/article/details/91040938
ValueError: setting an array element with a sequence._Python_qq_24140919的博客-CSDN博客
https://blog.csdn.net/qq_24140919/article/details/88851855
ValueError: setting an array element with a sequence. tensorflow numpy_人工智能_xgli的博客-CSDN博客
https://blog.csdn.net/lxg0807/article/details/53883671