Keras 源代码:如何到达?

Keras source codes: how to reach?

为了能够将 Keras 作为一种编程工具使用,有时需要查看方法的源代码。我知道 Keras 中的每个功能都是公开实现的,并且 public 可以访问。但不幸的是,在你没有足够的经验之前,在网上找到代码并不是一件容易的事。例如,在https://keras.io/中没有说明找到特定方法的来源的最简单方法是什么。

我的问题是有人可以告诉我 softmax activation 的 Keras 的实现与 Tensorflow 支持或推荐如何实现它的好方法吗?

看来 Keras 源代码可以在 Github for Keras 中找到。 与 Pytorch 的每个函数的文档都直接 link 到相应的源代码相反,在 Keras 中两者似乎是断开的。

查找其中特定组件源的一种方法是手动浏览上述 GIT 存储库中的文件夹..

我这样做了,发现它可以在 Keras Softmax Source Code 中找到。

可能有更好的方法获取此源代码,但我不知道。

您可以在 github using the search bar. You'll find it in keras/activations.py, which invokes the same function from the keras backend. All the backends are at keras/backend, and the tensorflow backend specifically is at keras/backend/tensorflow_backend.py. In tensorflow, you can find the corresponding kernel definition at tensorflow/core/kernels/softmax_op 上搜索存储库。

还有另一种获取源代码的方法,如果您没有使用最新版本(可在 github 上获得),它可能很有用,所以我将其添加到此处

如果你已经安装了keras包,你总是可以直接在你的电脑上找到keras源代码。它安装的目录是:/python3.your_version/site-packages/keras