ONE - On-device Neural Engine
Loading...
Searching...
No Matches
TensorBuilder.h
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
17#ifndef __ONERT_BACKEND_BUILTIN_TENSOR_BUILDER_H__
18#define __ONERT_BACKEND_BUILTIN_TENSOR_BUILDER_H__
19
23
24#include <ir/OperandIndexMap.h>
25
26#include <unordered_map>
27
29
30namespace onert
31{
32namespace backend
33{
34namespace builtin
35{
36
38{
39public:
40 TensorBuilder(const std::shared_ptr<TensorRegistry> &tensor_reg);
41
48
49 void notifyFirstUse(const ir::OperandIndex &);
50 void notifyLastUse(const ir::OperandIndex &);
51
52 bool isRegistered(const ir::OperandIndex &) const;
53
54 void allocate(void);
55
57
65
66private:
67 const std::shared_ptr<TensorRegistry> _tensor_reg;
68 std::unique_ptr<DynamicTensorManager> _dynamic_tensor_mgr;
69 std::unique_ptr<basic::StaticTensorManager> _static_tensor_mgr;
71};
72
73} // namespace builtin
74} // namespace backend
75} // namespace onert
76
77#endif // __ONERT_BACKEND_BUILTIN_TENSOR_BUILDER_H__
Class to manage dynamic tensor and its memory.
void notifyLastUse(const ir::OperandIndex &)
void registerTensorInfo(const ir::OperandIndex &ind, const ir::OperandInfo &info)
Register tensor information to allocate on CPU backend.
void notifyFirstUse(const ir::OperandIndex &)
basic::Tensor * nativeOwnTensorAt(const ir::OperandIndex &ind)
Get tensor with a specific OperandIndex.
DynamicTensorManager * dynamicTensorManager(void)
bool isRegistered(const ir::OperandIndex &) const
Class to save tensor's shape and type.
Definition OperandInfo.h:56
volatile const char info[]
std::unordered_map< OperandIndex, T > OperandIndexMap