2019-08-18 16:46:56 -07:00
|
|
|
#include <c10/util/Exception.h>
|
2020-03-26 11:15:49 -07:00
|
|
|
#include <test/cpp/jit/tests.h>
|
2020-03-27 12:03:42 -07:00
|
|
|
#include <test/cpp/tensorexpr/tests.h>
|
2019-08-18 16:46:56 -07:00
|
|
|
|
|
|
|
|
namespace torch {
|
|
|
|
|
namespace jit {
|
|
|
|
|
|
2020-03-16 11:18:16 -07:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
#define JIT_TEST_API
|
2019-08-18 16:46:56 -07:00
|
|
|
#else
|
2020-03-16 11:18:16 -07:00
|
|
|
#define JIT_TEST_API TORCH_API
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-08-18 16:46:56 -07:00
|
|
|
#define JIT_TEST(name) test##name();
|
2020-03-16 11:18:16 -07:00
|
|
|
JIT_TEST_API void runJITCPPTests(bool runCuda) {
|
2019-08-18 16:46:56 -07:00
|
|
|
TH_FORALL_TESTS(JIT_TEST)
|
|
|
|
|
if (runCuda) {
|
|
|
|
|
TH_FORALL_TESTS_CUDA(JIT_TEST)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This test is special since it requires prior setup in python.
|
2020-03-26 11:15:49 -07:00
|
|
|
// 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
|
2019-08-18 16:46:56 -07:00
|
|
|
// torch_python_test.cpp
|
|
|
|
|
testEvalModeForLoadedModule();
|
2020-01-07 16:19:01 -08:00
|
|
|
testTorchSaveError();
|
2019-08-18 16:46:56 -07:00
|
|
|
}
|
|
|
|
|
#undef JIT_TEST
|
2020-03-27 12:03:42 -07:00
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
2019-08-18 16:46:56 -07:00
|
|
|
} // namespace jit
|
|
|
|
|
} // namespace torch
|