【问题标题】:How do I get a tensor of an specific value and shape in tensorflow?如何在张量流中获得特定值和形状的张量?
【发布时间】:2019-05-18 23:48:03
【问题描述】:

我想制作一个特定形状的 0.9 张量。在tensorflow中有这个命令:

tf.ones_like()

所以我把形状放在那里,我有我的向量。我想做同样的事情,但其他值像 0.9,所以我想把形状像 tf.ones_like 但我想要这个数字 0.9 的张量

我该怎么做?

【问题讨论】:

    标签: python tensorflow machine-learning artificial-intelligence


    【解决方案1】:

    你可以使用填充

    # Output tensor has shape [2, 3].
    fill([2, 3], 0.9) ==> [[0.9, 0.9, 0.9]
                     [0.9, 0.9, 0.9]]
    

    【讨论】:

      猜你喜欢
      • 2018-12-13
      • 1970-01-01
      • 1970-01-01
      • 2021-06-12
      • 2016-12-12
      • 1970-01-01
      • 2021-05-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多