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