I study tensor flow using a cookbook for learning machines with tensor flow ( https://github.com/nfmcclure/tensorflow_cookbook ). I am currently in the NLP chapter (07). I am very confused by how the question of the sizes of variables of tensor flow is solved. For example, in the example with a bag of words, they use:
A = tf.Variable(tf.random_normal(shape=[embedding_size,1]))
b = tf.Variable(tf.random_normal(shape=[1,1]))
x_data = tf.placeholder(shape=[sentence_size], dtype=tf.int32)
y_target = tf.placeholder(shape=[1, 1], dtype=tf.float32)
and in the tf-idf example they use:
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)
How to decide when to use None vs 1 in placeholder forms? Thank!
source
share