mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: This PR add tensorexpr cpp tests to test_jit.py Pull Request resolved: https://github.com/pytorch/pytorch/pull/34897 Differential Revision: D20630760 Pulled By: Krovatkin fbshipit-source-id: 7d2f27aca6b1e23e3ffed1c765d8f590688118e3
43 lines
996 B
C++
43 lines
996 B
C++
#include <test/cpp/jit/tests.h>
|
|
#include <c10/util/Exception.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
|