Caffe2 - C++ API
A deep learning, cross platform ML framework
test.cpp
1 #if defined(USE_GTEST)
2 #include <gtest/gtest.h>
3 #endif
4 
5 // To add a new test file:
6 // 1. Add a test_foo.h file in this directory
7 // 2. include test_base.h
8 // 3. Write your tests as pure functions starting with "test", like "testFoo"
9 // 4. Include test_foo.h here and add it to the appropriate macro listing
10 #include <test/cpp/jit/test_alias_analysis.h>
11 #include <test/cpp/jit/test_argument_spec.h>
12 #include <test/cpp/jit/test_autodiff.h>
13 #include <test/cpp/jit/test_class_parser.h>
14 #include <test/cpp/jit/test_code_template.h>
15 #include <test/cpp/jit/test_constant_pooling.h>
16 #include <test/cpp/jit/test_create_autodiff_subgraphs.h>
17 #include <test/cpp/jit/test_custom_operators.h>
18 #include <test/cpp/jit/test_dynamic_dag.h>
19 #include <test/cpp/jit/test_fuser.h>
20 #include <test/cpp/jit/test_graph_executor.h>
21 #include <test/cpp/jit/test_interpreter.h>
22 #include <test/cpp/jit/test_ir.h>
23 #include <test/cpp/jit/test_irparser.h>
24 #include <test/cpp/jit/test_ivalue.h>
25 #include <test/cpp/jit/test_misc.h>
26 #include <test/cpp/jit/test_netdef_converter.h>
27 #include <test/cpp/jit/test_subgraph_utils.h>
28 
29 using namespace torch::jit::script;
30 using namespace torch::jit::test;
31 
32 namespace torch {
33 namespace jit {
34 #define TH_FORALL_TESTS(_) \
35  _(ADFormulas) \
36  _(Attributes) \
37  _(Blocks) \
38  _(CodeTemplate) \
39  _(ControlFlow) \
40  _(CreateAutodiffSubgraphs) \
41  _(CustomOperators) \
42  _(Differentiate) \
43  _(DifferentiateWithRequiresGrad) \
44  _(DynamicDAG) \
45  _(FromQualString) \
46  _(InternedStrings) \
47  _(IValue) \
48  _(Proto) \
49  _(RegisterFusionCachesKernel) \
50  _(SchemaParser) \
51  _(TopologicalIndex) \
52  _(TopologicalMove) \
53  _(SubgraphUtils) \
54  _(AliasAnalysis) \
55  _(WriteTracking) \
56  _(Wildcards) \
57  _(MemoryDAG) \
58  _(IRParser) \
59  _(ConstantPooling) \
60  _(NetDefConverter) \
61  _(THNNConv) \
62  _(ATenNativeBatchNorm) \
63  _(NoneSchemaMatch) \
64  _(ClassParser)
65 
66 #define TH_FORALL_TESTS_CUDA(_) \
67  _(ArgumentSpec) \
68  _(Fusion) \
69  _(GraphExecutor) \
70  _(Interp)
71 
72 #if defined(USE_GTEST)
73 
74 #define JIT_GTEST(name) \
75  TEST(JitTest, name) { \
76  test##name(); \
77  }
78 TH_FORALL_TESTS(JIT_GTEST)
79 #undef JIT_TEST
80 
81 #define JIT_GTEST_CUDA(name) \
82  TEST(JitTest, name##_CUDA) { \
83  test##name(); \
84  }
85 TH_FORALL_TESTS_CUDA(JIT_GTEST_CUDA)
86 #undef JIT_TEST_CUDA
87 #endif
88 
89 #define JIT_TEST(name) test##name();
90 void runJITCPPTests() {
91  TH_FORALL_TESTS(JIT_TEST)
92  TH_FORALL_TESTS_CUDA(JIT_TEST)
93 
94  // This test is special since it requires prior setup in python.
95  // So it's included here but not in the pure cpp gtest suite
96  testEvalModeForLoadedModule();
97 }
98 #undef JIT_TEST
99 } // namespace jit
100 } // namespace torch
Definition: jit_type.h:17