Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 没有足够的值来解包(预期为2,实际为0)_Python - Fatal编程技术网

Python 没有足够的值来解包(预期为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

我有以下错误:

没有足够的值来解包(预期为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
。您应该将结果转换为一个iterable,如
列表
元组
。尝试更改这行代码:

...
for batch in total_batch:
    batch_images, batch_labels = list(map(list, zip(*batch)))
...

请指定出现此错误的行您是否有任何空的
批处理
映射
是可编辑的。