neerajgosai19 / CONVOLUTIONAL-NEURAL-NETWORK

0 stars 0 forks source link

CONVOLUTIONAL NEURAL NETWORK (AttributeError: 'dict' object has no attribute 'test') #2

Open neerajgosai19 opened 4 years ago

neerajgosai19 commented 4 years ago

tf.compat.v1.disable_eager_execution() cross_entropy = tf.reduce_mean(-tf.reduce_sum(Ytf.compat.v1.log(Y))) train_step = tf.compat.v1.train.GradientDescentOptimizer(0.5).minimize(cross_entropy ) for i in range(1000): batch = mnist.train.next_batch(50) train_step.run(feed_dict= {X : batch[0], Y : batch[1]}) correct_prediction = tf.equal(tf.argmax(Y, 1), tf.argmax(Y, 1)) accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) acc = accuracy.eval(feed_dict={X: mnist.test.images, Y: mnist.test.labels}) 100 print("The final accuracy for the simple ANN model is: {} % ".format(acc) )

AttributeError Traceback (most recent call last)

in () 1 correct_prediction = tf.equal(tf.argmax(Y, 1), tf.argmax(Y, 1)) 2 accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) ----> 3 acc = accuracy.eval(feed_dict={X: mnist.test.images, Y: mnist.test.labels}) * 100 4 print("The final accuracy for the simple ANN model is: {} % ".format(acc) ) AttributeError: 'dict' object has no attribute 'test'