【问题标题】:ValueError: Argument must be a dense tensor: [['1', '2', '3'], ['1']] - got shape [2], but wanted [2, 3]ValueError: Argument must be a dense tensor: [['1', '2', '3'], ['1']] - 得到形状 [2],但想要 [2, 3]
【发布时间】:2018-12-13 12:21:20
【问题描述】:

使用 python 3.x tensorflow 版本 1.8.0

代码1:

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

鳕鱼2:

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

cod1 成功但 code2 错误:

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

tensorflow var 有余额吗? 为什么code2是错误的?

【问题讨论】:

标签: python python-3.x tensorflow


【解决方案1】:

您不能将具有不同大小的列表列表作为张量。

要解决它,请查看thisthis

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-07
    • 1970-01-01
    • 2022-07-16
    • 2019-12-02
    • 2019-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多