在 TensorFlow 中调试 Python 测试 [英] Debugging python tests in TensorFlow

查看:49
本文介绍了在 TensorFlow 中调试 Python 测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

We want to debug Python tests in TensorFlow such as sparse_split_op_test and string_to_hash_bucket_op_test

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

The other c++ tests we could debug using gdb, however we cannot find a way to debug python tests.

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

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)

推荐答案

我会先构建测试:

bazel build //tensorflow/python/kernel_tests:sparse_split_op_test

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

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.

这篇关于在 TensorFlow 中调试 Python 测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆