+++ /dev/null
-/*
- * Copyright (c) 2019 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.
- */
-
-#ifndef __NEURUN_COMPILER_ELEMENT_H__
-#define __NEURUN_COMPILER_ELEMENT_H__
-
-#include "model/Subgraph.h"
-#include "graph/LowerInfoMap.h"
-
-// TODO Put this in class Linear (as an inner class)
-namespace neurun
-{
-namespace compiler
-{
-
-struct Element
-{
- const model::Subgraph *subgraph;
- const graph::operation::LowerInfo *lower_info;
-
- Element(const model::Subgraph *subgraph, const graph::operation::LowerInfo *lower_info)
- : subgraph{subgraph}, lower_info{lower_info}
- {
- // DO NOTHING
- }
-};
-
-} // namespace compiler
-} // namespace neurun
-
-#endif // __NEURUN_COMPILER_ELEMENT_H__
***********************/
// Fix shapes
- linear->iterate([&](const compiler::Element &element) {
+ linear->iterate([&](const compiler::Linear::Element &element) {
auto backend = element.lower_info->backend();
auto shape_fixer = linear->getBackendContext(backend)->shape_fixer;
shape_fixer->fix(*element.subgraph);
auto execution_builder = nnfw::cpp14::make_unique<ExecutionBuilder>(*function_sequence);
// Generate kernels
- linear->iterate([&](const compiler::Element &element) {
+ linear->iterate([&](const compiler::Linear::Element &element) {
auto backend = element.lower_info->backend();
auto kernel_gen = linear->getBackendContext(backend)->kernel_gen;
kernel_gen->generate(*element.subgraph, execution_builder.get());
void Linear::generateConstantInitializers(void) const
{
- iterate([&](const compiler::Element &element) {
+ iterate([&](const compiler::Linear::Element &element) {
auto backend = element.lower_info->backend();
auto constant_initializer = _backend_resolver->getBackendContext(backend)->constant_initializer;
#include <vector>
#include <memory>
-#include "Element.h"
#include "model/Model.h"
#include "model/Subgraphs.h"
#include "backend/ITensorBuilder.h"
class Linear
{
public:
+ struct Element
+ {
+ const model::Subgraph *subgraph;
+ const graph::operation::LowerInfo *lower_info;
+
+ Element(const model::Subgraph *subgraph, const graph::operation::LowerInfo *lower_info)
+ : subgraph{subgraph}, lower_info{lower_info}
+ {
+ // DO NOTHING
+ }
+ };
+
+public:
Linear(const std::shared_ptr<const model::Model> &model,
std::unique_ptr<model::Subgraphs> subgraphs,
std::unique_ptr<graph::LowerInfoMap> lower_info_map,
#include "ExecutorBase.h"
#include "compiler/Plan.h"
-#include "compiler/Element.h"
+#include "compiler/Linear.h"
namespace neurun
{
const std::shared_ptr<compiler::OperandContext> &operand_context,
std::unique_ptr<graph::LowerInfoMap> lower_info,
std::unique_ptr<backend::MemoryManagerSet> mem_mgrs,
- std::unique_ptr<std::vector<compiler::Element>> elements,
+ std::unique_ptr<std::vector<compiler::Linear::Element>> elements,
const std::shared_ptr<const neurun::compiler::Plan> &plan)
: ExecutorBase{model, std::move(subgraphs), operand_context, std::move(lower_info),
std::move(mem_mgrs)},
private:
std::shared_ptr<const compiler::Plan> _plan;
- std::unique_ptr<std::vector<compiler::Element>> _elements;
+ std::unique_ptr<std::vector<compiler::Linear::Element>> _elements;
};
} // namespace exec