Confuses variable forms of tensor flow

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:

# 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)

and in the tf-idf example they use:

# 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)

How to decide when to use None vs 1 in placeholder forms? Thank!

+4
source share
2 answers

None , session. batch , . , None, . ( , )

, , , , ( feed_dict)

, y_target [1, 1], y_target [10, 1]/[200, 1]/[<whatever>, 1]

+4

"None" , . , , x_data, 1, , "" 1.

0

Source: https://habr.com/ru/post/1683682/


All Articles