简体   繁体   中英

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.

在此处输入图片说明

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM