diff options
author | 장지섭/On-Device Lab(SR)/Engineer/삼성전자 <jiseob.jang@samsung.com> | 2019-04-03 17:27:58 +0900 |
---|---|---|
committer | 박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com> | 2019-04-03 17:27:58 +0900 |
commit | 123d4db1c4d0fb5c7f8caeb0dc6f0a33f78408ff (patch) | |
tree | e4b5d0f3be011fd8dffd298c91045f777c16a7ca /runtimes | |
parent | 0b0af067aef19c1266b0de0b7c65c028a8cd3513 (diff) | |
download | nnfw-123d4db1c4d0fb5c7f8caeb0dc6f0a33f78408ff.tar.gz nnfw-123d4db1c4d0fb5c7f8caeb0dc6f0a33f78408ff.tar.bz2 nnfw-123d4db1c4d0fb5c7f8caeb0dc6f0a33f78408ff.zip |
Support GREATER_EQUAL and LESS (#4900)
* Append nnapi tests of GREATER_EQUAL and LESS
This commit appends nnapi tests of of GREATER_EQUAL and LESS.
Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
* [neurun] Support GREATER_EQUAL and LESS
This commit supports GREATER_EQUAL and LESS operations.
Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
Diffstat (limited to 'runtimes')
-rw-r--r-- | runtimes/neurun/frontend/nnapi/model.cc | 2 | ||||
-rw-r--r-- | runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc | 42 |
2 files changed, 43 insertions, 1 deletions
diff --git a/runtimes/neurun/frontend/nnapi/model.cc b/runtimes/neurun/frontend/nnapi/model.cc index 89a54f372..5a3b787e8 100644 --- a/runtimes/neurun/frontend/nnapi/model.cc +++ b/runtimes/neurun/frontend/nnapi/model.cc @@ -294,7 +294,7 @@ int ANeuralNetworksModel_addOperationEx(ANeuralNetworksModel *model, } const ANeuralNetworksOperationTypeEx FIRST_OPERATION = ANEURALNETWORKS_CAST_EX; - const ANeuralNetworksOperationTypeEx LAST_OPERATION = ANEURALNETWORKS_PRELU_EX; + const ANeuralNetworksOperationTypeEx LAST_OPERATION = ANEURALNETWORKS_LESS_EX; if ((type < FIRST_OPERATION) || (type > LAST_OPERATION)) { VERBOSE(NNAPI::Model) << "addOperation: Invalid operation type" << std::endl; diff --git a/runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc b/runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc index dd04ca06a..d88e8aaef 100644 --- a/runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc +++ b/runtimes/neurun/frontend/nnapi/wrapper/OperationFactory.cc @@ -618,6 +618,48 @@ OperationFactory::OperationFactory() return new operation::ExpNode{inputs, outputs}; }; + _map[ANEURALNETWORKS_GREATER_EQUAL_EX] = [](const OperationFactory::Param &init_param, + neurun::model::operand::Set &operands) { + assert(init_param.input_count == 2 && init_param.output_count == 1); + + operand::IndexSet outputs{init_param.outputs[0]}; + + // Each input should be interpreted as follows: + // + // 0 -> input0 Tensor Index + // 1 -> input1 Tensor Index + operand::IndexSet inputs{init_param.inputs[0], init_param.inputs[1]}; + + operation::ComparisonNode::Param param; + param.comparison_type = operation::ComparisonNode::ComparisonType::GreaterEqual; + + // Output operand type must be boolean + replaceDataType(operands, outputs.at(0), operand::DataType::TENSOR_BOOL8); + + return new operation::ComparisonNode{inputs, outputs, param}; + }; + + _map[ANEURALNETWORKS_LESS_EX] = [](const OperationFactory::Param &init_param, + neurun::model::operand::Set &operands) { + assert(init_param.input_count == 2 && init_param.output_count == 1); + + operand::IndexSet outputs{init_param.outputs[0]}; + + // Each input should be interpreted as follows: + // + // 0 -> input0 Tensor Index + // 1 -> input1 Tensor Index + operand::IndexSet inputs{init_param.inputs[0], init_param.inputs[1]}; + + operation::ComparisonNode::Param param; + param.comparison_type = operation::ComparisonNode::ComparisonType::Less; + + // Output operand type must be boolean + replaceDataType(operands, outputs.at(0), operand::DataType::TENSOR_BOOL8); + + return new operation::ComparisonNode{inputs, outputs, param}; + }; + _map[ANEURALNETWORKS_REDUCE_MAX_EX] = [](const OperationFactory::Param &init_param, neurun::model::operand::Set &) { assert(init_param.input_count == 2 && init_param.output_count == 1); |