tree: 391ad6074cfb4a06a8f8fbb50dca5d8ac237309d [path history] [tgz]
  1. upgrader_models/
  2. __init__.py
  3. CMakeLists.txt
  4. README.md
  5. script_module_v4.ptl
  6. script_module_v5.ptl
  7. script_module_v6.ptl
  8. source_range_test.cpp
  9. test_add_if_then_else.cpp
  10. test_alias_analysis.cpp
  11. test_argument_spec.cpp
  12. test_autodiff.cpp
  13. test_backend.cpp
  14. test_backend_compiler_lib.cpp
  15. test_backend_compiler_preprocess.cpp
  16. test_backend_lib.cpp
  17. test_class_import.cpp
  18. test_class_parser.cpp
  19. test_class_type.cpp
  20. test_cleanup_passes.cpp
  21. test_code_template.cpp
  22. test_concat_opt.cpp
  23. test_constant_pooling.cpp
  24. test_create_autodiff_subgraphs.cpp
  25. test_cs_debug_info_serialization.cpp
  26. test_custom_class.cpp
  27. test_custom_class_registrations.cpp
  28. test_custom_class_registrations.h
  29. test_custom_operators.cpp
  30. test_dce.cpp
  31. test_exception.cpp
  32. test_file_format.cpp
  33. test_flatbuffer.cpp
  34. test_fuser.cpp
  35. test_graph_executor.cpp
  36. test_graph_iterator.cpp
  37. test_inliner.cpp
  38. test_interface.cpp
  39. test_interpreter.cpp
  40. test_interpreter_async.pt
  41. test_ir.cpp
  42. test_irparser.cpp
  43. test_jit_logging_levels.cpp
  44. test_jit_type.cpp
  45. test_lite_interpreter.cpp
  46. test_lite_interpreter_direct.cpp
  47. test_lite_trainer.cpp
  48. test_load_upgraders.cpp
  49. test_memory_dag.cpp
  50. test_misc.cpp
  51. test_mobile_type_parser.cpp
  52. test_module_api.cpp
  53. test_op_replacement.cpp
  54. test_peephole_optimize.cpp
  55. test_qualified_name.cpp
  56. test_save_load.cpp
  57. test_schema_matching.cpp
  58. test_script_profile.cpp
  59. test_shape_analysis.cpp
  60. test_stack_opt.cpp
  61. test_subgraph_matcher.cpp
  62. test_subgraph_rewriter.cpp
  63. test_subgraph_utils.cpp
  64. test_union.cpp
  65. test_upgrader_utils.cpp
  66. test_utils.cpp
  67. test_utils.h
  68. tests_setup.py
  69. torch_python_test.cpp
test/cpp/jit/README.md

JIT C++ Tests

Adding a new test

First, create a new test file. Test files should have be placed in this directory, with a name that starts with test_, like test_foo.cpp.

In general a single test suite

Add your test file to the JIT_TEST_SRCS list in test/cpp/jit/CMakeLists.txt.

A test file may look like:

#include <gtest/gtest.h>

using namespace ::torch::jit

TEST(FooTest, BarBaz) {
   // ...
}

// Append '_CUDA' to the test case name will automatically filter it out if CUDA
// is not compiled.
TEST(FooTest, NeedsAGpu_CUDA) {
   // ...
}

// Similarly, if only one GPU is detected, tests with `_MultiCUDA` at the end
// will not be run.
TEST(FooTest, NeedsMultipleGpus_MultiCUDA) {
   // ...
}

Building and running the tests

The following commands assume you are in PyTorch root.

# ... Build PyTorch from source, e.g.
python setup.py develop
# (re)build just the binary
ninja -C build bin/test_jit
# run tests
build/bin/test_jit --gtest_filter='glob_style_filter*'