Debugging python tests in TensorFlow

python, tensorflow

Solution

I would first build the test:

bazel build //tensorflow/python/kernel_tests:sparse_split_op_test

Then use pdb on the resulting Python binary:

pdb bazel-bin/tensorflow/python/kernel_tests/sparse_split_op_test

That seems to work for me stepping through the first few lines of the test.

Problem

We want to debug Python tests in TensorFlow such as sparse_split_op_test and string_to_hash_bucket_op_test The other c++ tests we could debug using gdb, however we cannot find a way to debug python tests. Is there a way in which we can debug specific python test case run via Bazel test command (for example, bazel test //tensorflow/python/kernel_tests:sparse_split_op_test)

Original source