python evaluation_function tensorflow

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python evaluation_function tensorflow相关的知识,希望对你有一定的参考价值。

# add to training file, after variables have been defined
tf.add_to_collection('inputs', x)
tf.add_to_collection('inputs', y)
tf.add_to_collection('inputs', one_hot_y)
tf.add_to_collection('outputs', logits)
tf.add_to_collection('outputs', correct_prediction)
tf.add_to_collection('outputs', accuracy_operation)

# in testing file
with tf.Graph().as_default() as g:
    with tf.Session() as sess:
        loader = tf.train.import_meta_graph('lenet.meta')
        x,y, one_hot= tf.get_collection('inputs')
        logits, correct_prediction, accuracy_operation = tf.get_collection('outputs')
        loader.restore(sess, tf.train.latest_checkpoint('./'))
        
        test_accuracy = evaluate(X_test, y_test, sess)
        print("Test Accuracy = {:.3f}".format(test_accuracy))

以上是关于python evaluation_function tensorflow的主要内容,如果未能解决你的问题,请参考以下文章

Python代写,Python作业代写,代写Python,代做Python

Python开发

Python,python,python

Python 介绍

Python学习之认识python

python初识