How to see C ++ function calls behind the SWIG interface, TensorFlow

I am working on TensorFlow and want to know the relationship between each Python function and the corresponding C ++ functions behind the SWIG interface. In other words, I want to know exactly which C ++ functions are called for each line of Python code in my TensorFlow application.

I have already seen how to debug Python code here and how to display in which line of code a segmentation error occurs here , but in this way I can only see where the error is, instead I want to know every call to the C ++ function, even if in there are no errors in the code (at the moment when debugging with gdb I see system calls and calls to the dynamic library, but not calls to C ++ functions).

+8
source share
1 answer

The bulk of the code that is written by most people is for plotting. Almost all graphing is done entirely in Python, which simply creates data structures (Python), such as Operation and Graph , defined in ops.py The only exception is the form output, which occurs when you create each operation. The form output is called in C ++ through the interface defined in cpp_shape_inference.i . After creating the computational graph, you execute it by creating a Session and calling sess.run . These are all Python features wrapping the TensorFlow C API. Wrappers can be found in tf_session.i .

+3
source

Source: https://habr.com/ru/post/1013264/


All Articles