[neurun] Support 1x1x1x1 input for Squeeze (#8646)
author이상규/On-Device Lab(SR)/Principal Engineer/삼성전자 <sg5.lee@samsung.com>
Thu, 31 Oct 2019 09:11:53 +0000 (18:11 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Thu, 31 Oct 2019 09:11:53 +0000 (18:11 +0900)
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 <sg5.lee@samsung.com>
runtimes/neurun/backend/acl_cl/ShapeFixer.cc

index 26d4017..88e04b1 100644 (file)
@@ -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);