Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Tensorflow unit tests

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?

like image 350
Maksym Diachenko Avatar asked Dec 10 '15 14:12

Maksym Diachenko


People also ask

What is TF test?

Evaluation of a novel kit (TF-Test) for the diagnosis of intestinal parasitic infections.


2 Answers

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/... 
like image 102
mrry Avatar answered Sep 17 '22 00:09

mrry


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 
like image 35
Lucas Hendren Avatar answered Sep 17 '22 00:09

Lucas Hendren