added tf.argmax use conditional to tf version
@@ -3,6 +3,7 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
+from distutils.version import LooseVersion
import math
import numpy as np
import os
@@ -207,6 +208,10 @@ def model_eval(sess, x, y, model, X_test, Y_test, args=None):
assert args.batch_size, "Batch size was not given in args dict"
# Define accuracy symbolically
+ if LooseVersion(tf.__version__) >= LooseVersion('1.0.0'):
+ correct_preds = tf.equal(tf.argmax(y, axis=-1),
+ tf.argmax(model, axis=-1))
+ else:
correct_preds = tf.equal(tf.argmax(y, axis=tf.rank(y) - 1),
tf.argmax(model, axis=tf.rank(model) - 1))
acc_value = tf.reduce_mean(tf.to_float(correct_preds))
