ONE - On-device Neural Engine
Loading...
Searching...
No Matches
CirclePack.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 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
18
20
21#include <loco.h>
22#include <oops/UserExn.h>
23
24namespace luci
25{
26
28{
29 const auto &inputs = args.op.inputs;
30 const auto &outputs = args.op.outputs;
31 const auto *options = args.op.builtin_options.AsPackOptions();
32
33 if (options->values_count < 1)
34 return false;
35
36 if (inputs.size() != static_cast<uint32_t>(options->values_count))
37 return false;
38
39 if (outputs.size() != 1)
40 return false;
41
42 return true;
43}
44
45CircleNode *CirclePackGraphBuilder::build_node(const circle::OperatorT &op,
46 const std::vector<CircleNode *> &inputs,
47 loco::Graph *graph) const
48{
49 auto *node = graph->nodes()->create<CirclePack>(inputs.size());
50 for (uint32_t i = 0; i < inputs.size(); ++i)
51 {
52 node->values(i, inputs[i]);
53 }
54
55 const auto *options = op.builtin_options.AsPackOptions();
56 node->axis(options->axis);
57
58 return node;
59}
60
61} // namespace luci
A neural network graph.
Definition Graph.h:161
bool validate(const ValidateArgs &args) const final
PACK in Circle.
Definition CirclePack.h:34
Node * values(uint32_t index) const
Definition CirclePack.h:46