Python 没有足够的值来解包(预期为2,实际为0)
我有以下错误: 没有足够的值来解包(预期为2,实际为0) 请帮忙 这是我的密码:Python 没有足够的值来解包(预期为2,实际为0),python,Python,我有以下错误: 没有足够的值来解包(预期为2,实际为0) 请帮忙 这是我的密码: with tf.Session() as sess: ## Initialize the variables sess.run(tf.global_variables_initializer()) for epoch in range(training_epochs): for batch in total_batch: bat
with tf.Session() as sess:
## Initialize the variables
sess.run(tf.global_variables_initializer())
for epoch in range(training_epochs):
for batch in total_batch:
batch_images, batch_labels = map(list, zip(*batch))
batch_images = np.array(batch_images)
batch_labels = np.array(batch_labels).reshape(-1, 1)
## Run the training procedures
_, l, acc = sess.run([optimizer, loss, accuracy], feed_dict={x: batch_images, y:
batch_labels})
if epoch % display == 0:
print('\nEpoch: %d, Loss: %f, Accuracy: %f' % (epoch + 1, l, acc))
我相信这是由于使用了
map
。您应该将结果转换为一个iterable,如列表
或元组
。尝试更改这行代码:
...
for batch in total_batch:
batch_images, batch_labels = list(map(list, zip(*batch)))
...
请指定出现此错误的行您是否有任何空的
批处理?映射是可编辑的。