tf 的队列操作enqueue_many传入的值是列表,但是放入[]列表抛异常
File "C:UserslihongjieAppDataLocalProgramsPythonPython36libsite-packages ensorflowpythonopsdata_flow_ops.py", line 377, in enqueue_many batch_dim = vals[0].get_shape().with_rank_at_least(1)[0] File "C:UserslihongjieAppDataLocalProgramsPythonPython36libsite-packages ensorflowpythonframework ensor_shape.py", line 765, in with_rank_at_least raise ValueError("Shape %s must have rank at least %d" % (self, rank)) ValueError: Shape () must have rank at least 1
这是由于对于tf来说接收的一切值都是tensor张量,但是这里要想让enqueue_many知道传入的是列表可以设置 eqs = q.enqueue_many([[1.1,1.2,1.3],])
列表中多加一个逗号,后面不要加值,加了就不符合传入值;这样既是列表,又满足tf接收的是tensor张量的需求