Find blas calls happening under the hood when running inference

I have a trained model saved with tf.saved_model.save; loaded back with tf.saved_model.load . Now I’d like to know what blas routines are called when I run inference on this model. I’m curious about what’s going on under the hood; I would like to run the inference manually i.e. go through it step by step on my own and see if I can get the same results

Hi @dpk1 ,

  1. Enable Debugging and Logging:

    TensorFlow provides ways to enable detailed logging which can help you trace the operations being performed under the hood, including BLAS calls.

  2. Using TensorFlow Profiler:

    TensorFlow Profiler allows you to analyze the operations executed during inference. You can profile your inference and then analyze which operations (like matrix multiplications that might call BLAS routines) are taking place.

  3. Manually Inspecting the Graph:

    You can load the saved model and inspect its computation graph to see which operations are defined. Each operation in the graph can correspond to a specific low-level implementation that might involve BLAS routines.

  4. Running Inference Manually:

    You can also step through each operation manually by fetching the operations and tensors from the graph and executing them one by one.

  5. Inspecting BLAS Calls Directly:

    For more direct inspection of BLAS calls, you can:

  • Use tools like strace or ltrace to trace the library calls made by the TensorFlow process during inference.
  • Compile TensorFlow from source with debugging enabled, allowing you to step through the C++ code using a debugger like gdb.

Thank You .