summaryrefslogtreecommitdiff
path: root/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtimes/neurun/src/compiler/SubTensorAnalyzer.cc')
-rw-r--r--runtimes/neurun/src/compiler/SubTensorAnalyzer.cc78
1 files changed, 0 insertions, 78 deletions
diff --git a/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc b/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc
deleted file mode 100644
index 0851b7991..000000000
--- a/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "SubTensorAnalyzer.h"
-
-#include <typeinfo>
-
-#include "cpp14/memory.h"
-#include "model/operand/Set.h"
-#include "graph/operation/LowerInfo.h"
-#include "util/logging.h"
-
-namespace neurun
-{
-namespace compiler
-{
-
-void SubTensorAnalyzer::visit(const model::operation::ConcatNode &node)
-{
- // If operator is concat (or other operators related with subsumption), fill subsumption info
- // TODO: if one tensor is subset of many parents or model input
- // Solution 1. Handle 1st parent only, ignore others (need to invert for other childrun)
- // Solution 2. Insert copy operation for other parents
- auto axis_index = node.param().axis_index;
-
- // To prepare concat elimination, axis should be constant
- if (_ctx.at(axis_index).getUsage() != model::operand::OperandUsage::CONSTANT)
- {
- VERBOSE(SUBTENSOR) << "Cannot handle non-constant axis" << std::endl;
- return;
- }
-
- // NOTE This implementation assumes concat over feature depth
- // TODO Remove this assumption
- int32_t axis = _ctx.at(axis_index).asScalar<int32_t>();
- if (axis != 3)
- {
- VERBOSE(SUBTENSOR) << "Cannot handle axis is not channel" << std::endl;
- return;
- }
-
- auto &output_index = node.getOutputs().at(0);
- auto &inputs = node.getInputs();
-
- int32_t axis_point = 0;
- for (auto &input_index : inputs)
- {
- auto input_shape_4D = _ctx.at(input_index).lower_info()->shape();
- std::vector<int32_t> offset = {0, 0, 0, 0};
- offset[axis] = axis_point;
- neurun::util::feature::Coordinate4D coordinate_info(offset[0], offset[1], offset[2], offset[3]);
- std::unique_ptr<graph::operand::ParentInfo> parentInfo =
- nnfw::cpp14::make_unique<graph::operand::ParentInfo>(output_index, coordinate_info);
-
- // NOTD Not support multiple parent tensor yet
- assert(_ctx.at(input_index).parent_info() == nullptr);
- _ctx.at(input_index).parent_info(std::move(parentInfo));
-
- // NOTE Only support when axis is 3(channel)
- axis_point += input_shape_4D.c();
- }
-}
-
-} // namespace compiler
-} // namespace neurun