chang jc
chang jc

Reputation: 529

How to print (trace) within tensorflow's source code

I have a small trial to print out something within tensorflow's kernel.

ex, I would like to print something within

https://www.tensorflow.org/api_docs/python/tf/train/GradientDescentOptimizer

Then I search for the corresponding sources in my laptop where Ubuntu 16.04 has been installed.

Below are what I found.

enter image description here

I think gradient_descent.py within either

/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/optimizer_v2

or

/usr/local/lib/python3.5/dist-packages/tensorflow/python/training

are used. Hence I modify them both.

However, I cannot see the modifications.

I wonder why it failed.

Is there any way the trace Tensorflow source code (I know C & C++ part needs to be re-compile so focus on Python now)?

Thanks in advance.

Upvotes: 1

Views: 391

Answers (1)

Hangchen Y.
Hangchen Y.

Reputation: 355

Check CurrentStackTrace API provided by TensorFlow util. An example use can be found here.

Upvotes: 2

Related Questions