简体   繁体   English

Python Tensorflow ValueError:太多值无法解包

[英]Python Tensorflow ValueError: too many values to unpack

I am new to Tensorflow. 我是Tensorflow的新手。 I tried to put tensor list into the tf.train.batch() function, but I got an ValueError (too many values to unpack (expected 2)) . 我试图将张量列表放入tf.train.batch()函数中,但出现ValueError (too many values to unpack (expected 2)) Here is my code, and the error is from the second line. 这是我的代码,错误来自第二行。

g = tf.unstack(data, num = 60366, axis = 0)
X_mb, _ = tf.train.batch(g, 32, capacity = 60366)

My data is a [60366, 39] matrix. 我的数据是[60366,39]矩阵。

Can someone help me? 有人能帮我吗? Thx! 谢谢!

Looks like you need this: 看来您需要这个:

X_mb, *_ = tf.train.batch(g, 32, capacity = 60366)

or this: 或这个:

X_mb = tf.train.batch(g, 32, capacity = 60366)[0]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM