Reputation: 562
Is there any way to run Tensorflow unit tests manually? I want to perform sanity checks while modifying TF source code.
I see there are many _test.py files with classes that perform many test operations and I can't figure out how to run them. There should be an easy way?
Upvotes: 31
Views: 14418
Reputation: 2826
In addition to the above answer, you can run individual tests as shown instead of full packages, which can save a significant amount of time.
bazel run //tensorflow/python/kernel_tests:string_split_op_test
bazel run //tensorflow/python:special_math_ops_test
Or you can go to the individual directory and run all the tests there
cd python/kernel_tests
bazel run :one_hot_op_test
Upvotes: 8
Reputation: 126154
The easiest way to run the TensorFlow unit tests is using Bazel, assuming you have downloaded the source from Git:
# All tests (for C++ changes).
$ bazel test //tensorflow/...
# All Python tests (for Python front-end changes).
$ bazel test //tensorflow/python/...
# All tests (with GPU support).
$ bazel test -c opt --config=cuda //tensorflow/...
$ bazel test -c opt --config=cuda //tensorflow/python/...
Upvotes: 41