<s> '''<STR_LIT>''' <EOL> import tensorflow as tf <EOL> import numpy <EOL> import input_data <EOL> mnist = input_data . read_data_sets ( "<STR_LIT>" , one_hot = True ) <EOL> learning_rate = <NUM_LIT> <EOL> training_epochs = <NUM_LIT:10> <EOL> batch_size = <NUM_LIT:100> <EOL> display_step = <NUM_LIT:1> <EOL> x = tf . placeholder ( "<STR_LIT:float>" , [ None , <NUM_LIT> ] , name = '<STR_LIT:x>' ) <EOL> y = tf . placeholder ( "<STR_LIT:float>" , [ None , <NUM_LIT:10> ] , name = '<STR_LIT:y>' ) <EOL> W = tf . Variable ( tf . zeros ( [ <NUM_LIT> , <NUM_LIT:10> ] ) , name = "<STR_LIT>" ) <EOL> b = tf . Variable ( tf . zeros ( [ <NUM_LIT:10> ] ) , name = "<STR_LIT>" ) <EOL> activation = tf . nn . softmax ( tf . matmul ( x , W ) + b ) <EOL> cost = - tf . reduce_sum ( y * tf . log ( activation ) ) <EOL> optimizer = tf . train . GradientDescentOptimizer ( learning_rate ) . minimize ( cost ) <EOL> init = tf . initialize_all_variables ( ) <EOL> with tf . Session ( ) as sess : <EOL> sess . run ( init ) <EOL> summary_writer = tf . train . SummaryWriter ( '<STR_LIT>' , graph_def = sess . graph_def ) <EOL> for epoch in range ( training_epochs ) : <EOL> avg_cost = <NUM_LIT:0.> <EOL> total_batch = int ( mnist . train . num_examples / batch_size ) <EOL> for i in range ( total_batch ) : <EOL> batch_xs , batch_ys = mnist . train . next_batch ( batch_size ) <EOL> sess . run ( optimizer , feed_dict = { x : batch_xs , y : batch_ys } ) <EOL> avg_cost += sess . run ( cost , feed_dict = { x : batch_xs , y : batch_ys } ) / total_batch <EOL> if epoch % display_step == <NUM_LIT:0> : <EOL> print "<STR_LIT>" , '<STR_LIT>' % ( epoch + <NUM_LIT:1> ) , "<STR_LIT>" , "<STR_LIT>" . format ( avg_cost ) <EOL> print "<STR_LIT>" <EOL> correct_prediction = tf . equal ( tf . argmax ( activation , <NUM_LIT:1> ) , tf . argmax ( y , <NUM_LIT:1> ) ) <EOL> accuracy = tf . reduce_mean ( tf . cast ( correct_prediction , "<STR_LIT:float>" ) ) <EOL> print "<STR_LIT>" , accuracy . eval ( { x : mnist . test . images , y : mnist . test . labels } ) <EOL> '''<STR_LIT>''' </s>
