ONE - On-device Neural Engine
Loading...
Searching...
No Matches
CircleSVDF.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 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
23namespace luci
24{
25
27{
28 const auto &inputs = args.op.inputs;
29 if (!(inputs.size() == 4 || inputs.size() == 5))
30 return false;
31
32 return true;
33}
34
35CircleNode *CircleSVDFBuilder::build_node(const circle::OperatorT &op,
36 const std::vector<CircleNode *> &inputs,
37 loco::Graph *graph) const
38{
39 auto *node = graph->nodes()->create<CircleSVDF>();
40 node->input(inputs.at(0));
41 node->weight_feature(inputs.at(1));
42 node->weight_time(inputs.at(2));
43 if (inputs.size() == 4)
44 {
45 auto *bias = graph->nodes()->create<CircleOutputExclude>();
46 node->bias(bias);
47
48 node->input_activation_state(inputs.at(3));
49 }
50 else
51 {
52 node->bias(inputs.at(3));
53 node->input_activation_state(inputs.at(4));
54 }
55
56 const auto *options = op.builtin_options.AsSVDFOptions();
57 node->svdf_rank(options->rank);
58 node->fusedActivationFunction(luci_actfunc(options->fused_activation_function));
59 node->asymmetric_quantize_inputs(options->asymmetric_quantize_inputs);
60
61 return node;
62}
63
64} // namespace luci
A neural network graph.
Definition Graph.h:161
CircleOutputExclude is used to specifying not exported nodes.
bool validate(const ValidateArgs &args) const final
SVDF in Circle.
Definition CircleSVDF.h:33
loco::Node * input(void) const
Definition CircleSVDF.h:38
FusedActFunc luci_actfunc(const circle::ActivationFunctionType type)