Skip to content

Fix cmake paths for the runner module. #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/build_apple_frameworks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ mkdir -p "$HEADERS_PATH"
//runtime/executor:program \
//extension/data_loader: \
//extension/memory_allocator: \
//extension/runner/module: \
| rsync -av --files-from=- "$SOURCE_ROOT_DIR" "$HEADERS_PATH/executorch"

echo "Creating frameworks"
Expand Down
5 changes: 4 additions & 1 deletion build/print_exported_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def exported_headers(buck2: str, target: str) -> Set[str]:
deps = query(buck2, target, "exported_deps")
headers = set(query(buck2, target, "exported_headers"))
headers.update(
header for dep in deps for header in exported_headers(buck2, dep.split()[0])
header
for dep in deps
for header in exported_headers(buck2, dep.split()[0])
if header.endswith(".h")
)
return headers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
032C01B72AC329B6002955E1 /* CustomViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032C01B62AC329B6002955E1 /* CustomViews.swift */; };
032C01B92AC32ADF002955E1 /* CameraController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032C01B82AC32ADF002955E1 /* CameraController.swift */; };
032C01E82AC34B60002955E1 /* MobileNetClassifier.mm in Sources */ = {isa = PBXBuildFile; fileRef = 032C01902AC22B16002955E1 /* MobileNetClassifier.mm */; };
032C01E92AC34B63002955E1 /* Module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 032C01942AC22B16002955E1 /* Module.cpp */; };
032C01EC2AC34CAC002955E1 /* libMobileNetClassifier.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 032C01CB2AC34632002955E1 /* libMobileNetClassifier.a */; };
032C02032AC47CFB002955E1 /* mv3_xnnpack_fp32.pte in Resources */ = {isa = PBXBuildFile; fileRef = 032C01FC2AC47CFB002955E1 /* mv3_xnnpack_fp32.pte */; };
032C02082AC47CFB002955E1 /* imagenet_classes.txt in Resources */ = {isa = PBXBuildFile; fileRef = 032C02012AC47CFB002955E1 /* imagenet_classes.txt */; };
Expand Down Expand Up @@ -109,8 +108,6 @@
032C018E2AC22B16002955E1 /* MobileNet-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MobileNet-Bridging-Header.h"; sourceTree = "<group>"; };
032C01902AC22B16002955E1 /* MobileNetClassifier.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MobileNetClassifier.mm; sourceTree = "<group>"; };
032C01912AC22B16002955E1 /* MobileNetClassifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MobileNetClassifier.h; sourceTree = "<group>"; };
032C01932AC22B16002955E1 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = "<group>"; };
032C01942AC22B16002955E1 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Module.cpp; sourceTree = "<group>"; };
032C01B62AC329B6002955E1 /* CustomViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomViews.swift; sourceTree = "<group>"; };
032C01B82AC32ADF002955E1 /* CameraController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraController.swift; sourceTree = "<group>"; };
032C01CB2AC34632002955E1 /* libMobileNetClassifier.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMobileNetClassifier.a; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -242,8 +239,6 @@
032C018E2AC22B16002955E1 /* MobileNet-Bridging-Header.h */,
032C01912AC22B16002955E1 /* MobileNetClassifier.h */,
032C01902AC22B16002955E1 /* MobileNetClassifier.mm */,
032C01932AC22B16002955E1 /* Module.h */,
032C01942AC22B16002955E1 /* Module.cpp */,
);
path = MobileNet;
sourceTree = "<group>";
Expand Down Expand Up @@ -488,7 +483,6 @@
files = (
03C818252AC75E580084CC29 /* MobileNetClassifier.swift in Sources */,
032C01E82AC34B60002955E1 /* MobileNetClassifier.mm in Sources */,
032C01E92AC34B63002955E1 /* Module.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import "MobileNetClassifier.h"

#import <executorch/extension/runner/module.h>
#import <executorch/extension/runner/module/module.h>

using namespace ::torch::executor;

Expand Down Expand Up @@ -50,11 +50,8 @@ - (BOOL)classifyWithInput:(float*)input
outputSize:(NSInteger)outputSize
error:(NSError**)error {
int32_t sizes[] = {1, kChannels, kSize, kSize};
uint8_t order[] = {0, 1, 2, 3};
int32_t strides[] = {kChannels * kSize * kSize, kSize * kSize, kSize, 1};
TensorImpl tensorImpl(
ScalarType::Float, std::size(sizes), sizes, input, order, strides);
std::vector<EValue> inputs = {EValue(Tensor(&tensorImpl))};
TensorImpl tensorImpl(ScalarType::Float, std::size(sizes), sizes, input);
std::vector<EValue> inputs{EValue(Tensor(&tensorImpl))};
std::vector<EValue> outputs;

const auto torchError = _module->forward(inputs, outputs);
Expand Down
2 changes: 1 addition & 1 deletion extension/runner/module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cmake_minimum_required(VERSION 3.19)

# Source root directory for executorch.
if(NOT EXECUTORCH_ROOT)
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
endif()

list(TRANSFORM _extension_runner_module__srcs PREPEND "${EXECUTORCH_ROOT}/")
Expand Down