【问题标题】:DNN: using framework like Theano or TensorFlow, how to make sure the gradient or calculation is correct when the NN has more than several layers?DNN:使用 Theano 或 TensorFlow 等框架,当 NN 有多个层时,如何确保梯度或计算正确?
【发布时间】:2016-05-31 14:22:14
【问题描述】:

我已经为神经网络编写了一些 python 或 matlab 代码,但没有使用任何框架或自动微分,但正如我们所知,Theano 和 TensorFlow 使用自动微分,你构建一个计算图,它们会计算(反向传播)你,但有时编写的程序可以运行但绝对不能按我的意愿运行,所以我想知道有一些方法来确保我的程序是正确的? 打印构造的计算图?但是当 NN 层数很大时看起来很复杂,比如 Imagenet 的获胜者采用了 152 层 或者使用简单的matlab或python代码编写另一个程序,然后将这个输出与使用框架的程序进行比较?

【问题讨论】:

标签: neural-network theano tensorflow deep-learning


【解决方案1】:

标准解决方案是数值梯度检查。您可以通过在两个附近的值上进行前向传播来低效地计算梯度。

请参阅此处有关数值梯度检查的部分: https://web.stanford.edu/class/cs294a/sparseAutoencoder_2011new.pdf

在 TensorFlow 中,这是使用 compute_numeric_jacobian here 实现的。

【讨论】:

  • 您好,如何对 tensorflow 或 theano 使用数值梯度检查,您有一些示例代码吗?我看到他们使用数值梯度检查来实现单个操作以确保操作正确。
  • 这里是 Theano 文档关于如何测试毕业生。它使用了雅罗斯拉夫使用的技术:deeplearning.net/software/theano/extending/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-01
  • 2015-09-16
  • 2018-07-23
  • 2019-07-31
  • 2020-02-10
  • 2017-03-17
相关资源
最近更新 更多