ONE - On-device Neural Engine
Loading...
Searching...
No Matches
mir2loco.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "mir/Graph.h"
18#include "mir/Visitor.h"
19#include "loco.h"
20
21namespace mir2loco
22{
23
24class Transformer final : public mir::Visitor
25{
26public:
27 Transformer() = default;
28 ~Transformer() = default;
29
30 void visit(mir::ops::AddOp &op) override;
31 void visit(mir::ops::AvgPool2DOp &op) override;
32 void visit(mir::ops::ConcatOp &op) override;
33 void visit(mir::ops::ConstantOp &op) override;
34 void visit(mir::ops::Conv2DOp &op) override;
35 void visit(mir::ops::DeConv2DOp &op) override;
36 void visit(mir::ops::DepthwiseConv2DOp &op) override;
37 void visit(mir::ops::DivOp &op) override;
38 void visit(mir::ops::FullyConnectedOp &op) override;
39 void visit(mir::ops::InputOp &op) override;
40 void visit(mir::ops::MaxPool2DOp &op) override;
41 void visit(mir::ops::MulOp &op) override;
42 void visit(mir::ops::OutputOp &op) override;
43 void visit(mir::ops::ReluOp &op) override;
44 void visit(mir::ops::ReshapeOp &op) override;
45 void visit(mir::ops::SoftmaxOp &op) override;
46 void visit(mir::ops::SubOp &op) override;
47 void visit(mir::ops::TransposeOp &op) override;
48
49 void visit_fallback(mir::Operation &op) override;
50
51 std::unique_ptr<loco::Graph> transform(mir::Graph *mir_graph);
52
53private:
54 std::unique_ptr<loco::Graph> _loco_graph;
55 std::unordered_map<mir::Operation::Output *, loco::Node *> _mir2loco_map;
56};
57
58} // namespace mir2loco
void visit(mir::ops::AddOp &op) override
Definition mir2loco.cpp:266
std::unique_ptr< loco::Graph > transform(mir::Graph *mir_graph)
Definition mir2loco.cpp:710
void visit_fallback(mir::Operation &op) override
Definition mir2loco.cpp:708
Base visitor with empty fallback function.
Definition Visitor.h:51
Description of tensor concatenation operation.
Definition ConcatOp.h:31
description of softmax operation.
Definition SoftmaxOp.h:31
Tensor transpose operation.
Definition TransposeOp.h:34