我正在學習使用張量流機器學習食譜的張量流(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