我正在学习使用张量流机器学习食谱的张量流(https://github.com/nfmcclure/tensorflow_cookbook)。我目前在NLP章节(07)。我对如何决定张量变量的维数感到困惑。例如,在单词例如袋,他们使用:关于张量流变量形状的困惑
# Create variables for logistic regression
A = tf.Variable(tf.random_normal(shape=[embedding_size,1]))
b = tf.Variable(tf.random_normal(shape=[1,1]))
# Initialize placeholders
x_data = tf.placeholder(shape=[sentence_size], dtype=tf.int32)
y_target = tf.placeholder(shape=[1, 1], dtype=tf.float32)
,并在TF-IDF例如他们使用:
# Create variables for logistic regression
A = tf.Variable(tf.random_normal(shape=[max_features,1]))
b = tf.Variable(tf.random_normal(shape=[1,1]))
x_data = tf.placeholder(shape=[None, max_features], dtype=tf.float32)
y_target = tf.placeholder(shape=[None, 1], dtype=tf.float32)
怎样才能当上在使用无对1决定占位符形状?谢谢!
看一看[this answer](https://stackoverflow.com/ question/37096225/how-to-understand-static-shape-and-dynamic-shape-tensorflow)来解释如何在Tensorflow中处理形状 – GPhilo