ONE - On-device Neural Engine
Loading...
Searching...
No Matches
CircleUnique.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
21
22#include <loco.h>
23
24namespace luci
25{
26
28{
29 if (args.op.inputs.size() != 1)
30 return false;
31
32 if (args.op.outputs.size() != 2)
33 return false;
34
35 return true;
36}
37
38CircleNode *CircleUniqueGraphBuilder::build_node(const BuildNodeArgs &bna) const
39{
40 auto node = bna.context->graph()->nodes()->create<CircleUnique>();
41
42 node->input(bna.input_nodes[0]);
43
44 const auto *options = bna.op.builtin_options.AsUniqueOptions();
45 node->idx_out_type(luci_datatype(options->idx_out_type));
46
47 return node;
48}
49
50CircleNode *CircleUniqueGraphBuilder::build_out(const BuildOutArgs &boa) const
51{
52 auto *nodeout = boa.node->graph()->nodes()->create<CircleUniqueOut>();
53
54 nodeout->input(boa.node);
55 nodeout->index(boa.index);
56
57 return nodeout;
58}
59
60} // namespace luci
NodeContext * nodes(void)
Definition Graph.h:218
Graph * graph(void)
Definition Node.h:70
Derived * create(Args &&...args)
Definition NodePool.h:37
bool validate(const ValidateArgs &args) const final
Unique in Circle.
loco::Node * input(void) const
loco::DataType luci_datatype(circle::TensorType type)