如何在GPU上的TensorFlow中创建具有确定性操作的CNN? [英] How to create a CNN with deterministic operations in TensorFlow on a GPU?

查看:102
本文介绍了如何在GPU上的TensorFlow中创建具有确定性操作的CNN?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我意识到TensorFlow中存在不确定性的操作后,请参阅以下问题:,我想知道:

So after I realize there are operations in TensorFlow which are non-deterministic, see this Question: How to get the same loss value, every time training a CNN (MNIST data set), with TensorFlow?, I want to know:

我如何使用以下方法构建卷积神经网络:

How can I build a convolutional neural net with:


  • TensorFlow版本1.1.0

  • CUDA版本8.0,V8.0.61

  • cuDNN 5.1.10

  • 在GPU上运行

  • TensorFlow Version 1.1.0
  • CUDA release 8.0, V8.0.61
  • cuDNN 5.1.10
  • run on GPU

仅使用确定性操作?

推荐答案

直到cuDNN上的每个操作都不完全是确定性的,您才能这样做。
而且,即使在GPU上移动了每个操作,如果它使用(并且可能确实使用了)SSE指令,也可以多次执行相同的相同(没有随机性)代码,从而获得不同的结果。

You can't until every operation on cuDNN is not completely deterministic. Moreover, even moving every operation on the GPU, if it uses (and it probably does) SSE instructions you could obtain different results executing the same identical (and without randomness) code more than once.

为接近目标,您可以做的最好的事情就是为每个包含随机性的操作设置 seed 级别种子)并设置整个图的种子( tf.set_random_seed(value))。

The best thing you can do to get close to your goal, it to set the seed for every operation that contains randomness (the op-level seed) and set the seed for the whole graph (tf.set_random_seed(value)).

这篇关于如何在GPU上的TensorFlow中创建具有确定性操作的CNN?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆