[英]not enough values to unpack (expected 2, got 0)
我有以下错误:
没有足够的值来解包(预期为 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:
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
。 您应该将结果转换为可迭代的,例如list
或tuple
。 尝试更改这行代码:
...
for batch in total_batch:
batch_images, batch_labels = list(map(list, zip(*batch)))
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.