Skip to content

Commit 26e6ced

Browse files
authored
Temporary fix for Android CI failure (#5889)
* Unblock the Android CI * Add python to android ci's command
1 parent 910bbfe commit 26e6ced

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

onnxruntime/core/providers/nnapi/nnapi_builtin/builders/model_builder.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,12 @@ Status ModelBuilder::RegisterModelInputs() {
263263
shape.push_back(SafeInt<uint32_t>(dim.dim_value()));
264264
}
265265

266-
ORT_RETURN_IF_NOT(GetAndroidSdkVer() >= 29 || !shape.empty(),
267-
"0-rank input is only supported on Android API level 29+");
266+
// NNAPI has strict input type requirements which separates tensor inputs and scalar inputs
267+
// For ONNX the we do not have clear line between scalar inputs and tensor inputs
268+
// Also NNAPI treats a tensor input with empty shape as dynamic shape input
269+
// Disable support of the scalar input (tensor input with an empty shape) for now
270+
// TODO, add support for ONNX scalar input (tensor input with an empty shape)
271+
ORT_RETURN_IF_NOT(!shape.empty(), "0-rank input is not currently supported, input name, ", input_name);
268272

269273
Type type = Type::TENSOR_FLOAT32;
270274
float scale = 0.0f;

onnxruntime/core/providers/nnapi/nnapi_builtin/nnapi_execution_provider.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,10 @@ common::Status NnapiExecutionProvider::Compile(const std::vector<FusedNodeAndGra
312312
// Also NNAPI treats a tensor input with empty shape as dynamic shape input
313313
// Disable support of the scalar input (tensor input with an empty shape) for now
314314
// TODO, add support for ONNX scalar input (tensor input with an empty shape)
315-
if (dimensions.empty())
316-
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "NNAPI does not support scalar input");
317-
315+
if (dimensions.empty()) {
316+
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT,
317+
"NNAPI does not support scalar input, input name, ", input_name);
318+
}
318319
// it is possible that the input has the detailed size while
319320
// the model has an operand with unknown size, use the size
320321
// of the actual input

tools/ci_build/github/azure-pipelines/android-x86_64-crosscompile-ci-pipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
steps:
77
- script: brew install coreutils ninja
88
displayName: Install coreutils and ninja
9-
- script: tools/ci_build/build.py --android --build_dir build --android_sdk_path $ANDROID_HOME --android_ndk_path $ANDROID_HOME/ndk-bundle --android_abi=x86_64 --android_api=29 --skip_submodule_sync --parallel --cmake_generator=Ninja --build_java
9+
- script: python3 tools/ci_build/build.py --android --build_dir build --android_sdk_path $ANDROID_HOME --android_ndk_path $ANDROID_HOME/ndk-bundle --android_abi=x86_64 --android_api=29 --skip_submodule_sync --parallel --cmake_generator=Ninja --build_java
1010
displayName: CPU EP, Build and Test on Android Emulator
11-
- script: tools/ci_build/build.py --android --build_dir build_nnapi --android_sdk_path $ANDROID_HOME --android_ndk_path $ANDROID_HOME/ndk-bundle --android_abi=x86_64 --android_api=29 --skip_submodule_sync --parallel --use_nnapi --cmake_generator=Ninja --build_java
11+
- script: python3 tools/ci_build/build.py --android --build_dir build_nnapi --android_sdk_path $ANDROID_HOME --android_ndk_path $ANDROID_HOME/ndk-bundle --android_abi=x86_64 --android_api=29 --skip_submodule_sync --parallel --use_nnapi --cmake_generator=Ninja --build_java
1212
displayName: NNAPI EP, Build and Test on Android Emulator

0 commit comments

Comments
 (0)