Skip to content

Commit 2d4b0f0

Browse files
committed
check api in isnodesupported()
1 parent 52abfa8 commit 2d4b0f0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/onnx2daq/OnnxConverter.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#include <glog/logging.h>
1212
#include <onnx/optimizer/optimize.h>
1313
#include <onnx/shape_inference/implementation.h>
14+
#ifdef __ANDROID__
15+
#include <dnnlibrary/nnapi_implementation.h>
16+
#endif
1417
#include "NodeAttrHelper.h"
1518

1619
using std::string;
@@ -439,6 +442,11 @@ dnn::optional<Shaper::Shape> GetShape(
439442
std::pair<bool, std::string> OnnxConverter::IsNodeSupported(
440443
const ONNX_NAMESPACE::ModelProto &model_proto,
441444
const ONNX_NAMESPACE::NodeProto &node) const {
445+
#ifdef __ANDROID__
446+
if (GetAndroidSdkVersion() < 27) {
447+
return {false, "Android API level is lower than 27"};
448+
}
449+
#endif
442450
NodeAttrHelper helper(node);
443451
const auto &op = node.op_type();
444452
const std::vector<std::string> supported_types{

0 commit comments

Comments
 (0)