weights = tf.Variable( tf.truncated_normal([IMAGE_PIXELS, hidden1_units], stddev=1./math.sqrt(float(IMAGE_PIXELS)), name='weights') ) biases = tf.Variable(tf.zeros([hidden1_units]), name='biases')
images_placeholder = tf.placeholder(tf.float32, shape=[batch_size, IMAGE_PIXELS])
labels_placeholder = tf.placeholder(tf.int32, shape=[batch_size])
以下則是兩者真實的使用場景:函數
for step in range(FLAGS.max_steps): feed_dict = { images_placeholder = images_feed, labels_placeholder = labels_feed } _, loss_value = sess.run([train_op, loss], feed_dict=feed_dict)
當執行這些操做時,tf.Variable 的值將會改變,也即被修改,這也是其名稱的來源(variable,變量)。spa