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