#include <TensorManager.h>
|
static constexpr uint64_t | _align = 16 |
|
Definition at line 30 of file TensorManager.h.
◆ TensorManager()
onert::backend::train::TensorManager::TensorManager |
( |
const std::shared_ptr< TensorRegistry > & |
reg, |
|
|
uint32_t |
optim_vars_count |
|
) |
| |
Definition at line 52 of file TensorManager.cc.
54 _trainable_mgr{new TrainableMemoryManager(optim_vars_count)},
56
57 _disposable_back_prop_mgr{new DisposableMemoryManager()},
58 _layer_scope_mgr{new LayerScopeMemoryManager()}, _tensors{reg}
59{
60
61}
backend::basic::MemoryManager MemoryManager
◆ ~TensorManager()
virtual onert::backend::train::TensorManager::~TensorManager |
( |
| ) |
|
|
virtualdefault |
◆ allocateBackPropTensors()
void onert::backend::train::TensorManager::allocateBackPropTensors |
( |
| ) |
|
Definition at line 88 of file TensorManager.cc.
89{
90 allocateMemory(_back_prop_mgr.get(), _tensors->back_prop_tensors(),
91 std::string{" BACK_PROP TENSOR "});
92}
◆ allocateDisposableBackPropTensors()
void onert::backend::train::TensorManager::allocateDisposableBackPropTensors |
( |
| ) |
|
Definition at line 100 of file TensorManager.cc.
101{
102 allocateMemory(_disposable_back_prop_mgr.get(), _tensors->disposable_back_prop_tensors(),
103 std::string{"DISPOSABLE BACK_PROP TENSOR "});
104}
◆ allocateGradientTensors()
void onert::backend::train::TensorManager::allocateGradientTensors |
( |
| ) |
|
Definition at line 94 of file TensorManager.cc.
95{
96 allocateMemory(_gradient_mgr.get(), _tensors->gradient_tensors(),
97 std::string{" GRADIENT TENSOR "});
98}
◆ allocateLayerScopeTensors()
void onert::backend::train::TensorManager::allocateLayerScopeTensors |
( |
| ) |
|
Definition at line 106 of file TensorManager.cc.
107{
108 allocateMemory(_layer_scope_mgr.get(), _tensors->layerscope_tensors(),
109 std::string{" LAYERSCOPE TENSOR "});
110}
◆ allocateNonConstTensors()
void onert::backend::train::TensorManager::allocateNonConstTensors |
( |
| ) |
|
Definition at line 63 of file TensorManager.cc.
64{
65 allocateMemory(_nonconst_mgr.get(), _tensors->nonconst_tensors(),
66 std::string{" TENSOR "});
67}
◆ allocateTrainableTensors()
void onert::backend::train::TensorManager::allocateTrainableTensors |
( |
| ) |
|
Definition at line 69 of file TensorManager.cc.
70{
71 allocateMemory(_trainable_mgr.get(), _tensors->trainable_tensors(),
72 std::string{" TRAINABLE TENSOR "});
73
74
75
76 for (const auto &[index, trainable_tensor] : _tensors->trainable_tensors())
77 {
78 for (uint32_t var_pos = 0; var_pos < trainable_tensor->optVars().
size(); ++var_pos)
79 {
80 auto *buffer = _trainable_mgr.get()->getOptVarBuffer(index, var_pos);
81 trainable_tensor->setOptVarBuffer(buffer, var_pos);
82 VERBOSE(TensorManager) << std::string{
" OPTIM_VAR TENSOR "} <<
index <<
" : "
83 << static_cast<void *>(buffer) << std::endl;
84 }
85 }
86}
#define VERBOSE(name, lv)
loco::GraphInputIndex index(const TFPlaceholder *node)
References VERBOSE.
◆ claimBackPropPlan()
void onert::backend::train::TensorManager::claimBackPropPlan |
( |
const ir::OperandIndex & |
ind | ) |
|
Definition at line 144 of file TensorManager.cc.
145{
146 auto tensor = _tensors->getBackPropTensor(index);
147 assert(tensor && !
tensor->is_dynamic());
148
150 _back_prop_mgr->claimPlan(index,
size);
151}
static constexpr uint64_t _align
References _align, and size.
◆ claimDisposableBackPropPlan()
void onert::backend::train::TensorManager::claimDisposableBackPropPlan |
( |
const DisposableTensorIndex & |
ind | ) |
|
Definition at line 176 of file TensorManager.cc.
177{
178 const auto tensor = _tensors->getDisposableBackPropTensor(index);
179 assert(tensor && !
tensor->is_dynamic());
180
182 _disposable_back_prop_mgr->claimPlan(index,
size);
183}
References _align, and size.
◆ claimGradientPlan()
void onert::backend::train::TensorManager::claimGradientPlan |
( |
const ir::OperandIndex & |
ind | ) |
|
Definition at line 160 of file TensorManager.cc.
161{
162 auto tensor = _tensors->getGradientTensor(index);
163 assert(tensor && !
tensor->is_dynamic());
164
166 _gradient_mgr->claimPlan(index,
size);
167}
References _align, and size.
◆ claimLayerScopePlan()
Definition at line 193 of file TensorManager.cc.
194{
195 const auto tensor = _tensors->getLayerScopeTensor(index);
196
198 _layer_scope_mgr->claimPlan(index,
size);
199}
References _align, and size.
◆ claimNonConstPlan()
void onert::backend::train::TensorManager::claimNonConstPlan |
( |
const ir::OperandIndex & |
ind | ) |
|
Definition at line 112 of file TensorManager.cc.
113{
114 auto tensor = _tensors->getNonConstTensor(index);
115 assert(tensor && !
tensor->is_dynamic());
116
118 _nonconst_mgr->claimPlan(index,
size);
119}
References _align, and size.
◆ claimTrainablePlan()
void onert::backend::train::TensorManager::claimTrainablePlan |
( |
const ir::OperandIndex & |
ind | ) |
|
Definition at line 128 of file TensorManager.cc.
129{
130 auto tensor = _tensors->getTrainableTensor(index);
131 assert(tensor && !
tensor->is_dynamic());
132
134 _trainable_mgr->claimPlan(index,
size);
135}
References _align, and size.
◆ releaseBackPropPlan()
void onert::backend::train::TensorManager::releaseBackPropPlan |
( |
const ir::OperandIndex & |
ind | ) |
|
Definition at line 153 of file TensorManager.cc.
154{
155 assert(_tensors->getBackPropTensor(index) && !_tensors->getBackPropTensor(index)->is_dynamic());
156
157 _back_prop_mgr->releasePlan(index);
158}
◆ releaseDisposableBackPropPlan()
void onert::backend::train::TensorManager::releaseDisposableBackPropPlan |
( |
const DisposableTensorIndex & |
ind | ) |
|
Definition at line 185 of file TensorManager.cc.
186{
187 assert(_tensors->getDisposableBackPropTensor(index) &&
188 !_tensors->getDisposableBackPropTensor(index)->is_dynamic());
189
190 _disposable_back_prop_mgr->releasePlan(index);
191}
◆ releaseGradientPlan()
void onert::backend::train::TensorManager::releaseGradientPlan |
( |
const ir::OperandIndex & |
ind | ) |
|
Definition at line 169 of file TensorManager.cc.
170{
171 assert(_tensors->getGradientTensor(index) && !_tensors->getGradientTensor(index)->is_dynamic());
172
173 _gradient_mgr->releasePlan(index);
174}
◆ releaseLayerScopePlan()
Definition at line 201 of file TensorManager.cc.
202{
203 assert(_tensors->getLayerScopeTensor(index));
204 _layer_scope_mgr->releasePlan(index);
205}
◆ releaseNonConstPlan()
void onert::backend::train::TensorManager::releaseNonConstPlan |
( |
const ir::OperandIndex & |
ind | ) |
|
Definition at line 121 of file TensorManager.cc.
122{
123 assert(_tensors->getNonConstTensor(index) && !_tensors->getNonConstTensor(index)->is_dynamic());
124
125 _nonconst_mgr->releasePlan(index);
126}
◆ releaseTrainablePlan()
void onert::backend::train::TensorManager::releaseTrainablePlan |
( |
const ir::OperandIndex & |
ind | ) |
|
Definition at line 137 of file TensorManager.cc.
138{
139 assert(_tensors->getTrainableTensor(index) && !_tensors->getTrainableTensor(index)->is_dynamic());
140
141 _trainable_mgr->releasePlan(index);
142}
◆ _align
constexpr uint64_t onert::backend::train::TensorManager::_align = 16 |
|
staticconstexpr |
The documentation for this class was generated from the following files: