ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
31{
32
34{
35public:
36 TensorBuilder(const std::shared_ptr<TensorRegistry> &tensor_reg);
37
44
45 void notifyFirstUse(const ir::OperandIndex &);
46 void notifyLastUse(const ir::OperandIndex &);
47
48 bool isRegistered(const ir::OperandIndex &) const;
49
50 void allocate(void);
51
53
61
62private:
63 const std::shared_ptr<TensorRegistry> _tensor_reg;
64 std::unique_ptr<DynamicTensorManager> _dynamic_tensor_mgr;
65 std::unique_ptr<basic::StaticTensorManager> _static_tensor_mgr;
67};
68
69} // namespace onert::backend::builtin
70
71#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:54
volatile const char info[]
std::unordered_map< OperandIndex, T > OperandIndexMap