use*_*206 2 python-3.x tensorflow
在tensorflow中,我发现API tf.add_to_collcetion为集合添加一些值,如下面的代码.
def accuracy_rate(logits, labels):
correct = tf.nn.in_top_k(logits, labels, 1)
# Return the accuracy of true entries.
accuracy = tf.reduce_mean(tf.cast(correct, tf.float32))
return accuracy
with tf.Session() as sess:
logits, labels = ...
accuracy = accuracy_rate(logits, labels)
tf.add_to_collection('total_accuracy', sess.run(accuracy))
Run Code Online (Sandbox Code Playgroud)
我在API中找不到的是,如何清除我已经存储在一个集合中的所有值?
归档时间: |
|
查看次数: |
1225 次 |
最近记录: |