在 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列向量吗?
谢谢。
最佳答案
我通过一些调试找到了答案。
[batch_size] = [ 0, 2, ...]
[batch_size, 1] = [ [0], [2], ...]
虽然仍然不知道为什么使用第二种形式。
关于 tensorflow 。 [batch_size, 1] 和 [batch_size] 之间的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36662204/