ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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::cker
27{
28class FCTempArena;
29} // namespace nnfw::cker
30
32{
33
35{
36public:
39
40public:
42
44
46
48
50
52
53 void configure(const IPortableTensor *input, const IPortableTensor *weights,
54 const IPortableTensor *bias, ir::Activation activation,
56 const std::shared_ptr<ExternalContext> &external_context);
57
58 void run() override;
59
60 void prepare() override;
61
62protected:
67
69 std::unique_ptr<nnfw::cker::FCTempArena> _temp_arena;
70
71 std::shared_ptr<ExternalContext> _external_context;
72
73 bool _is_hybrid : 1;
75
76#ifdef USE_RUY_GEMV
77 uint8_t *_cached_weights = nullptr; // weights to be cached and a key
78 bool _is_weights_freed = false; // is weights freed?
79#endif
80};
81
82} // namespace onert::backend::cpu::ops
83
84#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)
FullyConnectedWeightsFormat