【问题标题】:Tensorflow. Difference between [batch_size, 1] & [batch_size]张量流。 [batch_size, 1] 和 [batch_size] 之间的区别
【发布时间】:2016-04-16 09:02:49
【问题描述】:

tensorflow tutorial for word embedding 中找到:

# Placeholders for inputs
train_inputs = tf.placeholder(tf.int32, shape=[batch_size])
train_labels = tf.placeholder(tf.int32, shape=[batch_size, 1])

这两个占位符之间可能有什么区别。它们不都是batch_size大小的int32列向量吗?

谢谢。

【问题讨论】:

    标签: tensorflow dimensions


    【解决方案1】:

    我通过一点调试找到了答案。

    [batch_size] = [ 0, 2, ...]
    [batch_size, 1] = [ [0], [2], ...]
    

    虽然还是不知道为什么要使用第二种形式。

    【讨论】:

    • 第二个版本是第一个版本的转置版本。
    【解决方案2】:

    train_inputs 是行向量,train_labels 是列向量。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-09
      • 2020-08-24
      • 2018-10-21
      • 1970-01-01
      • 1970-01-01
      • 2020-08-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多