From: 이상규/On-Device Lab(SR)/Principal Engineer/삼성전자 Date: Thu, 31 Oct 2019 09:11:53 +0000 (+0900) Subject: [neurun] Support 1x1x1x1 input for Squeeze (#8646) X-Git-Tag: submit/tizen/20191205.083104~477 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2fb56f3d3bde055a063b8ce82afc6b5bde354db5;p=platform%2Fcore%2Fml%2Fnnfw.git [neurun] Support 1x1x1x1 input for Squeeze (#8646) Squeeze will handle 1x1x1x1 input using ShapeFixer. Scalar output will be fixed to rank-1 one element tensor. The output value will be transfer to app without trouble since nnfw runtime API get output values using buffer pointer and buffer length. Signed-off-by: Sanggyu Lee --- diff --git a/runtimes/neurun/backend/acl_cl/ShapeFixer.cc b/runtimes/neurun/backend/acl_cl/ShapeFixer.cc index 26d4017..88e04b1 100644 --- a/runtimes/neurun/backend/acl_cl/ShapeFixer.cc +++ b/runtimes/neurun/backend/acl_cl/ShapeFixer.cc @@ -116,6 +116,8 @@ void ShapeFixer::visit(const model::operation::ReshapeNode &node) void ShapeFixer::visit(const model::operation::SqueezeNode &node) { const auto output_index{node.getOutputs().at(0)}; + if (_ctx.at(output_index).shape().rank() == 0) + const_cast<::neurun::model::Shape &>(_ctx.at(output_index).shape()).extendRank(1); const auto input_index{node.getInputs().at(model::operation::SqueezeNode::Input::INPUT)}; _tensor_builder->dimCorrection(input_index, false); _tensor_builder->dimCorrection(output_index, false);