TensorFlow取数据批次的代码中有一句 yield inputs[excerpt], inputsp[excerpt] 编译后报错TypeError: only integer scalar arrays can be converted to a scalar index 改成 yield np.array(inputs)[excerpt], np.array(inputsp)[excerpt]
就可以了。
inputs 和inputsp 都是list,可能是要这样转化为numpy里的array才能用shuffle(indices) 去索引吧。

本文介绍了一个常见的TensorFlow数据批处理错误:TypeError,当尝试使用列表进行索引时出现。通过将列表转换为numpy数组,可以解决此问题,并顺利地应用shuffle(indices)进行数据集的随机化。
6842

被折叠的 条评论
为什么被折叠?



