Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,12 @@ Status ModelBuilder::RegisterModelInputs() {
shape.push_back(SafeInt<uint32_t>(dim.dim_value()));
}

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

Type type = Type::TENSOR_FLOAT32;
float scale = 0.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,10 @@ common::Status NnapiExecutionProvider::Compile(const std::vector<FusedNodeAndGra
// Also NNAPI treats a tensor input with empty shape as dynamic shape input
// Disable support of the scalar input (tensor input with an empty shape) for now
// TODO, add support for ONNX scalar input (tensor input with an empty shape)
if (dimensions.empty())
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "NNAPI does not support scalar input");

if (dimensions.empty()) {
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT,
"NNAPI does not support scalar input, input name, ", input_name);
}
// it is possible that the input has the detailed size while
// the model has an operand with unknown size, use the size
// of the actual input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
steps:
- script: brew install coreutils ninja
displayName: Install coreutils and ninja
- 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
- 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
displayName: CPU EP, Build and Test on Android Emulator
- 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
- 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
displayName: NNAPI EP, Build and Test on Android Emulator