python - 在 TensorFlow 中调试 python 测试

标签 python tensorflow

我们想在 TensorFlow 中调试 Python 测试,例如 sparse_split_op_teststring_to_hash_bucket_op_test

我们可以使用 gdb 调试其他 c++ 测试,但是我们找不到调试 python 测试的方法。

有没有一种方法可以调试通过 Bazel 测试命令运行的特定 python 测试用例(例如,bazel test//tensorflow/python/kernel_tests:sparse_split_op_test)

最佳答案

我会先构建测试:

bazel build //tensorflow/python/kernel_tests:sparse_split_op_test

然后在生成的 Python 二进制文件上使用 pdb:

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

这似乎对我逐步完成测试的前几行有用。

关于python - 在 TensorFlow 中调试 python 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40340131/

相关文章:

python - Keras (tensorflow) 找到 GPU,但只在 cpu w/Cuda 10.1 上运行

python - 每个纪元都覆盖剧情

python - TensorFlow DCGAN 模型 : stability and convergence problems

python - Keras & TensorFlow : getting 2nd derivative of f(x) wrt x, 其中 dim(x) = (1, n)

python - ThreadPoolExecutor 记录? (Python)

python - 将控制权传递给 Flask 中的不同处理程序(类似于 Node.js Express)

python - 如果我在列表上使用+=,但对于扩展效果很好,为什么在赋值之前引用局部变量?

python - 为什么这个神经网络什么也没学到?

python - 如何通过索引而不是名称获取列?

python - 如何在 Python Pandas 中使用逗号作为小数分隔符的浮点格式?