mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-24 22:17:32 +00:00
Some minor updates for ORT mobile (#5146)
* Minor update ios build instructions and other comments * Create shared string for nodearg name
This commit is contained in:
parent
e5892dd6f3
commit
6fcd99f6ed
5 changed files with 21 additions and 13 deletions
11
BUILD.md
11
BUILD.md
|
|
@ -143,7 +143,7 @@ Currently only supported on Windows and Linux.
|
|||
* dotnet is required for building csharp bindings and creating managed nuget package. Follow the instructions [here](https://dotnet.microsoft.com/download) to download dotnet. Tested with versions 2.1 and 3.1.
|
||||
* nuget.exe. Follow the instructions [here](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools#nugetexe-cli) to download nuget
|
||||
* On Windows, downloading nuget is straightforward and simply following the instructions above should work.
|
||||
* On Linux, nuget relies on Mono runtime and therefore this needs to be setup too. Above link has all the information to setup Mono and nuget. The instructions can directly be found [here](https://www.mono-project.com/docs/getting-started/install/). In some cases it is required to run `sudo apt-get install mono-complete` after installing mono.
|
||||
* On Linux, nuget relies on Mono runtime and therefore this needs to be setup too. Above link has all the information to setup Mono and nuget. The instructions can directly be found [here](https://www.mono-project.com/docs/getting-started/install/). In some cases it is required to run `sudo apt-get install mono-complete` after installing mono.
|
||||
|
||||
### Build Instructions
|
||||
#### Windows
|
||||
|
|
@ -1053,21 +1053,26 @@ Android NNAPI Execution Provider can be built using building commands in [Androi
|
|||
* iOS simulator with x86_64 architecture
|
||||
|
||||
armv7, armv7s and i386 architectures are not currently supported.
|
||||
|
||||
tvOS and watchOS platforms are not currently supported.
|
||||
* apple_deploy_target
|
||||
|
||||
Specify the minimum version of the target platform (iOS) on which the target binaries are to be deployed.
|
||||
* Code Signing
|
||||
|
||||
The onnxruntime library is not code signed, it may be required or desired to code sign the library for iOS devices. For more information, see [Code Signing](https://developer.apple.com/support/code-signing/).
|
||||
|
||||
#### Build Instructions
|
||||
Run one of the following build scripts from the ONNX Runtime repository root,
|
||||
##### Cross build for iOS device
|
||||
```
|
||||
/build.sh --config <Release|Debug|RelWithDebInfo|MinSizeRel> --use_xcode \
|
||||
--ios --ios_sysroot iphoneos --osx_arch arm64 --apple_deploy_target 12
|
||||
--ios --ios_sysroot iphoneos --osx_arch arm64 --apple_deploy_target <minimal iOS version>
|
||||
```
|
||||
##### Cross build for iOS simulator
|
||||
```
|
||||
/build.sh --config <Release|Debug|RelWithDebInfo|MinSizeRel> --use_xcode \
|
||||
--ios --ios_sysroot iphonesimulator --osx_arch x86_64 --apple_deploy_target 12
|
||||
--ios --ios_sysroot iphonesimulator --osx_arch x86_64 --apple_deploy_target <minimal iOS version>
|
||||
```
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ table SessionState {
|
|||
}
|
||||
|
||||
table InferenceSession {
|
||||
// This is the ort format model version
|
||||
// This is the ORT format model version
|
||||
// The version number is defined as kOrtModelVersion in <repo root>/onnxruntime/core/session/inference_session.cc
|
||||
// Please update it when there is a change to this schema which will break the compatibilites
|
||||
ort_version:string;
|
||||
|
|
|
|||
|
|
@ -492,12 +492,13 @@ Status Node::SaveToOrtFormat(flatbuffers::FlatBufferBuilder& builder,
|
|||
}
|
||||
|
||||
auto GetNodeArgsOrtFormat = [&builder](const std::vector<NodeArg*>& src) {
|
||||
std::vector<std::string> node_args(src.size());
|
||||
std::vector<flatbuffers::Offset<flatbuffers::String>> node_args(src.size());
|
||||
std::transform(src.cbegin(), src.cend(), node_args.begin(),
|
||||
[](const NodeArg* nodearg) {
|
||||
return nodearg->Name();
|
||||
[&builder](const NodeArg* nodearg) {
|
||||
// NodeArg's name will be used by multiple places, create shared string
|
||||
return builder.CreateSharedString(nodearg->Name());
|
||||
});
|
||||
return builder.CreateVectorOfStrings(node_args);
|
||||
return builder.CreateVector(node_args);
|
||||
};
|
||||
|
||||
auto name = builder.CreateString(name_);
|
||||
|
|
@ -2706,10 +2707,12 @@ std::string Graph::GenerateNodeArgName(const std::string& base_name) {
|
|||
|
||||
static flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>>
|
||||
SaveInputsOutputsToOrtFormat(flatbuffers::FlatBufferBuilder& builder, const std::vector<const NodeArg*>& src) {
|
||||
std::vector<std::string> vec(src.size());
|
||||
std::vector<flatbuffers::Offset<flatbuffers::String>> vec(src.size());
|
||||
std::transform(src.cbegin(), src.cend(), vec.begin(),
|
||||
[](const NodeArg* entry) { return entry->Name(); });
|
||||
return builder.CreateVectorOfStrings(vec);
|
||||
[&builder](const NodeArg* entry) {
|
||||
return builder.CreateSharedString(entry->Name());
|
||||
});
|
||||
return builder.CreateVector(vec);
|
||||
}
|
||||
|
||||
common::Status Graph::SaveToOrtFormat(flatbuffers::FlatBufferBuilder& builder,
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ static Status SaveTypeInfoOrtFormat(flatbuffers::FlatBufferBuilder& builder,
|
|||
Status SaveValueInfoOrtFormat(flatbuffers::FlatBufferBuilder& builder,
|
||||
const ValueInfoProto& value_info_proto,
|
||||
flatbuffers::Offset<fbs::ValueInfo>& fbs_value_info) {
|
||||
auto name = builder.CreateString(value_info_proto.name());
|
||||
auto name = builder.CreateSharedString(value_info_proto.name());
|
||||
auto doc_string = builder.CreateString(value_info_proto.doc_string());
|
||||
flatbuffers::Offset<fbs::TypeInfo> type_info = 0; // 0 indicates null
|
||||
if (value_info_proto.has_type()) {
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ common::Status Model::SaveToOrtFormat(flatbuffers::FlatBufferBuilder& builder,
|
|||
flatbuffers::Offset<fbs::Model>& fbs_model) const {
|
||||
auto producer_name = builder.CreateString(model_proto_.producer_name());
|
||||
auto producer_version = builder.CreateString(model_proto_.producer_version());
|
||||
auto domain = builder.CreateString(model_proto_.domain());
|
||||
auto domain = builder.CreateSharedString(model_proto_.domain());
|
||||
auto doc_string = builder.CreateString(model_proto_.doc_string());
|
||||
|
||||
std::vector<flatbuffers::Offset<fbs::OperatorSetId>> op_set_ids_vec;
|
||||
|
|
|
|||
Loading…
Reference in a new issue