forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
torch_python_test.cpp
42 lines (36 loc) · 996 Bytes
/
torch_python_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <c10/util/Exception.h>
#include <test/cpp/jit/tests.h>
#include <test/cpp/tensorexpr/tests.h>
namespace torch {
namespace jit {
#ifdef _MSC_VER
#define JIT_TEST_API
#else
#define JIT_TEST_API TORCH_API
#endif
#define JIT_TEST(name) test##name();
JIT_TEST_API void runJITCPPTests(bool runCuda) {
TH_FORALL_TESTS(JIT_TEST)
if (runCuda) {
TH_FORALL_TESTS_CUDA(JIT_TEST)
}
// This test is special since it requires prior setup in python.
// So it is not part of the general test list (which is shared between the
// gtest and python test runners), but is instead invoked manually by the
// torch_python_test.cpp
testEvalModeForLoadedModule();
testTorchSaveError();
}
#undef JIT_TEST
#define JIT_TEST(name) test##name();
JIT_TEST_API void runTENSOREXPRCPPTests(bool runCuda) {
TH_FORALL_TENSOREXPR_TESTS(JIT_TEST)
if (runCuda) {
#ifdef USE_CUDA
TH_FORALL_TENSOREXPR_TESTS_CUDA(JIT_TEST)
#endif
}
}
#undef JIT_TEST
} // namespace jit
} // namespace torch