ValueError:参数必须为密集张量:[[''1','2','3'],['1']]-形状为[2],但需要[2,3]

时间:2018-07-05 05:51:46

标签: python python-3.x tensorflow

使用python 3.x tensorflow版本1.8.0

代码1:

a2 = [['1', '2'], ['1', '2']]
print(tf.shape(a2))

cod2:

a2 = [['1', '2', '3'], ['1']] 
print(tf.shape(a2))

cod1成功,但代码2错误:

ValueError: Argument must be a dense tensor: [['1', '2', '3'], ['1']] - got shape [2], but wanted [2, 3].

tensorflow var是否有平衡? 为什么code2错误?

1 个答案:

答案 0 :(得分:1)

您不能拥有张量不同的列表列表。

要解决此问题,请查看thisthis

相关问题