迷失在 Tensorflow github 存储库中

Lost in Tensorflow github repository

有没有一种方法可以有效地搜索存储库中的特定函数? 例如,我正在寻找一些 tensorflow.image 函数的代码,但我完全迷失在它们存储库的结构中。

Tensorflow repo 中所有图像函数的正确路径是tensorflow/tensorflow/python/ops/image_ops。 Github 很棒,因为它的搜索栏允许您解析根文件夹中的每个文件。

您尝试过使用 ipython 吗? Ipython 可以定位任意函数的源码。为此,只需安装 tensorflow 和 运行:

$ ipython
In [1]: import tensorflow as tf
In [2]: ?tf.image

输出:

Type: module

String Form:

File: /usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/image_ops.py

Docstring: ...

tf.image 因此在 tensorflow/python/ops/image_ops.py 中实现。

您还可以使用 ? 获取有关函数的信息,例如 ?tf.image.decode_jpeg