Skip to content

Commit 7605ce4

Browse files
cccclaifacebook-github-bot
authored andcommitted
[PyTorch] Enable test_lite_interpreter_runtime running in android (pytorch#54579)
Summary: Pull Request resolved: pytorch#54579 ## Summary 1. Eliminate a few more tests when BUILD_LITE_INTERPRETER is on, such that test_lite_interpreter_runtime can build and run on device. 2. Remove `#include <torch/torch.h>`, because it's not needed. ## Test plan Set the BUILD_TEST=ON `in build_android.sh`, then run ` BUILD_LITE_INTERPRETER=1 ./scripts/build_pytorch_android.sh x86` push binary to android device: ``` adb push ./build_android_x86/bin/test_lite_interpreter_runtime /data/local/tmp ``` Reorganize the folder in `/data/local/tmp` so the test binary and model file is like following: ``` /data/local/tmp/test_bin/test_lite_interpreter_runtime /data/local/tmp/test/cpp/lite_interpreter_runtime/sequence.ptl ``` such that the model file is in the correct path and can be found by the test_lite_interpreter_runtime. ![image](https://user-images.githubusercontent.com/16430979/112276332-d89d1900-8c3d-11eb-91de-7bf10d1e418d.png) Test Plan: Imported from OSS Reviewed By: iseeyuan Differential Revision: D27300720 Pulled By: cccclai fbshipit-source-id: d9526c7d3db8c0d3e76c5a4d604c6877c78afdf9
1 parent 673ed46 commit 7605ce4

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

aten/src/ATen/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ endif()
3636
# NB: If you edit these globs, you'll have to update setup.py package_data as well
3737
file(GLOB_RECURSE ATen_CORE_HEADERS "core/*.h")
3838
file(GLOB_RECURSE ATen_CORE_SRCS "core/*.cpp")
39-
file(GLOB_RECURSE ATen_CORE_TEST_SRCS "core/*_test.cpp")
39+
if(NOT BUILD_LITE_INTERPRETER)
40+
file(GLOB_RECURSE ATen_CORE_TEST_SRCS "core/*_test.cpp")
41+
endif()
4042
EXCLUDE(ATen_CORE_SRCS "${ATen_CORE_SRCS}" ${ATen_CORE_TEST_SRCS})
4143

4244
file(GLOB base_h "*.h" "detail/*.h" "cpu/*.h" "cpu/vec256/*.h" "quantized/*.h")

modules/module_test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if(NOT CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO)
66
option(BUILD_SHARED_LIBS "Build shared libs." ON)
77
endif()
88

9-
if(BUILD_TEST)
9+
if(BUILD_TEST AND NOT BUILD_LITE_INTERPRETER)
1010
add_library(
1111
caffe2_module_test_dynamic
1212
${CMAKE_CURRENT_SOURCE_DIR}/module_test_dynamic.cc)

test/cpp/lite_interpreter_runtime/test_lite_interpreter_runtime.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <torch/csrc/jit/frontend/resolver.h>
55
#include <torch/csrc/jit/mobile/import.h>
66
#include <torch/csrc/jit/mobile/module.h>
7-
#include <torch/torch.h>
87

98
#include <unordered_set>
109

0 commit comments

Comments
 (0)