mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-23 23:04:52 +08:00
Summary: This adds a check to catch the case where someone `torch.save`s something then `torch::jit::load`s it in C++. Relevant for #31620 ](https://our.intern.facebook.com/intern/diff/19252172/) Pull Request resolved: https://github.com/pytorch/pytorch/pull/31709 Pulled By: driazati Differential Revision: D19252172 fbshipit-source-id: f2a9b4442647285418b2778306629b4ff77c15e5
30 lines
775 B
C++
30 lines
775 B
C++
#include <test/cpp/jit/tests.h>
|
|
#include <c10/util/Exception.h>
|
|
|
|
namespace torch {
|
|
namespace jit {
|
|
|
|
#if defined(_WIN32)
|
|
void runJITCPPTests(bool runCuda) {
|
|
TORCH_INTERNAL_ASSERT(false, "JIT tests not yet supported on Windows");
|
|
}
|
|
#else
|
|
#define JIT_TEST(name) test##name();
|
|
TORCH_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
|
|
#endif
|
|
} // namespace jit
|
|
} // namespace torch
|