ONE - On-device Neural Engine
Loading...
Searching...
No Matches
FullyConnectedLayer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 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#ifndef __ONERT_BACKEND_CPU_OPS_FULLYCONNECTEDLAYER_H__
18#define __ONERT_BACKEND_CPU_OPS_FULLYCONNECTEDLAYER_H__
19
21#include "../ExternalContext.h"
22#include "OperationUtils.h"
23
24#include <exec/IFunction.h>
25
26namespace nnfw
27{
28namespace cker
29{
30class FCTempArena;
31}
32} // namespace nnfw
33
34namespace onert
35{
36namespace backend
37{
38namespace cpu
39{
40namespace ops
41{
42
44{
45public:
48
49public:
51
53
55
57
59
61
62 void configure(const IPortableTensor *input, const IPortableTensor *weights,
63 const IPortableTensor *bias, ir::Activation activation,
65 const std::shared_ptr<ExternalContext> &external_context);
66
67 void run() override;
68
69 void prepare() override;
70
71protected:
76
78 std::unique_ptr<nnfw::cker::FCTempArena> _temp_arena;
79
80 std::shared_ptr<ExternalContext> _external_context;
81
82 bool _is_hybrid : 1;
84
85#ifdef USE_RUY_GEMV
86 uint8_t *_cached_weights = nullptr; // weights to be cached and a key
87 bool _is_weights_freed = false; // is weights freed?
88#endif
89};
90
91} // namespace ops
92} // namespace cpu
93} // namespace backend
94} // namespace onert
95
96#endif // __ONERT_BACKEND_CPU_OPS_FULLYCONNECTEDLAYER_H__
A tensor class that is portable for other backends.
std::unique_ptr< nnfw::cker::FCTempArena > _temp_arena
std::shared_ptr< ExternalContext > _external_context
void configure(const IPortableTensor *input, const IPortableTensor *weights, const IPortableTensor *bias, ir::Activation activation, ir::FullyConnectedWeightsFormat weights_format, IPortableTensor *output, const std::shared_ptr< ExternalContext > &external_context)
Definition topk_v2.h:30
FullyConnectedWeightsFormat