Skip to content

Commit 3147b6c

Browse files
committed
refactor(//tests/models): renaming models tests to modules
- Adds a README for the module tests - Removes an unecessary script - Adds the multiple engines test to the test suite Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 57f953e commit 3147b6c

File tree

8 files changed

+18
-25
lines changed

8 files changed

+18
-25
lines changed

tests/models/simple_net.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/models/BUILD renamed to tests/modules/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_suite(
88
tests = [
99
":test_modules_as_engines",
1010
":test_compiled_modules",
11+
":test_multiple_registered_engines"
1112
]
1213
)
1314

tests/modules/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Module Level Tests
2+
3+
These tests focus on integration testing of the backend, using the public apis. They require TorchScript modules saved to files. You can download the set of modules used by default in the tests by running hub.py (you need PyTorch 1.4.0) installed.
4+
5+
## Running Tests
6+
7+
``` shell
8+
bazel test //tests/modules:test_modules --compilation_mode=dbg --test_output=errors
9+
```
File renamed without changes.
File renamed without changes.

tests/models/test_compiled_modules.cpp renamed to tests/modules/test_compiled_modules.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ TEST_P(ModuleTests, CompiledModuleIsClose) {
2828
INSTANTIATE_TEST_SUITE_P(CompiledModuleForwardIsCloseSuite,
2929
ModuleTests,
3030
testing::Values(
31-
PathAndInSize({"tests/models/lenet.jit.pt",
31+
PathAndInSize({"tests/modules/lenet.jit.pt",
3232
{{1,1,28,28}}}),
33-
PathAndInSize({"tests/models/resnet18.jit.pt",
33+
PathAndInSize({"tests/modules/resnet18.jit.pt",
3434
{{1,3,224,224}}}),
35-
PathAndInSize({"tests/models/resnet50.jit.pt",
35+
PathAndInSize({"tests/modules/resnet50.jit.pt",
3636
{{1,3,224,224}}})));

tests/models/test_modules_as_engines.cpp renamed to tests/modules/test_modules_as_engines.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ TEST_P(ModuleTests, ModuleAsEngineIsClose) {
1919
INSTANTIATE_TEST_SUITE_P(ModuleAsEngineForwardIsCloseSuite,
2020
ModuleTests,
2121
testing::Values(
22-
PathAndInSize({"tests/models/lenet.jit.pt",
22+
PathAndInSize({"tests/modules/lenet.jit.pt",
2323
{{1,1,28,28}}}),
24-
PathAndInSize({"tests/models/resnet18.jit.pt",
24+
PathAndInSize({"tests/modules/resnet18.jit.pt",
2525
{{1,3,224,224}}}),
26-
PathAndInSize({"tests/models/resnet50.jit.pt",
26+
PathAndInSize({"tests/modules/resnet50.jit.pt",
2727
{{1,3,224,224}}})));

tests/models/test_multiple_registered_engines.cpp renamed to tests/modules/test_multiple_registered_engines.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ TEST(ModuleTests, CanRunMultipleEngines) {
88
torch::jit::script::Module mod1;
99
torch::jit::script::Module mod2;
1010
try {
11-
mod1 = torch::jit::load("tests/models/resnet50.jit.pt");
12-
mod2 = torch::jit::load("tests/models/resnet18.jit.pt");
11+
mod1 = torch::jit::load("tests/modules/resnet50.jit.pt");
12+
mod2 = torch::jit::load("tests/modules/resnet18.jit.pt");
1313
}
1414
catch (const c10::Error& e) {
1515
std::cerr << "error loading the model\n";

0 commit comments

Comments
 (0)