aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLFullyConnectedLayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/CL/functions/CLFullyConnectedLayer.cpp')
-rw-r--r--src/runtime/CL/functions/CLFullyConnectedLayer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/runtime/CL/functions/CLFullyConnectedLayer.cpp b/src/runtime/CL/functions/CLFullyConnectedLayer.cpp
index ae10cd23b1..c719a667a7 100644
--- a/src/runtime/CL/functions/CLFullyConnectedLayer.cpp
+++ b/src/runtime/CL/functions/CLFullyConnectedLayer.cpp
@@ -80,6 +80,11 @@ void CLFullyConnectedLayer::configure(const CLCompileContext &compile_context, c
_impl->op->configure(compile_context, input->info(), weights->info(), (biases != nullptr) ? biases->info() : nullptr, output->info(), fc_info);
+ if(_impl->weights_manager != nullptr)
+ {
+ _impl->weights_manager->manage(weights);
+ }
+
_impl->aux_mem_req = _impl->op->workspace();
_impl->run_pack = { { ACL_SRC_0, input }, { ACL_SRC_1, weights }, { ACL_SRC_2, biases }, { ACL_DST, output } };
_impl->workspace = manage_workspace<CLTensor>(_impl->aux_mem_req, _impl->memory_group, _impl->run_pack, _impl->run_pack);
@@ -108,6 +113,19 @@ void CLFullyConnectedLayer::prepare()
// Release temporary tensors that are only used in prepare stage
release_temporaries<CLTensor>(_impl->aux_mem_req, _impl->workspace);
_impl->is_prepared = true;
+
+ // Handle weights managed infrastructure
+ if(_impl->weights_manager != nullptr && _impl->weights_manager->are_weights_managed(_impl->original_weights))
+ {
+ // If function marks b as unused ensure that all prepare stages are done before releasing
+ const ITensor *original_b = _impl->original_weights;
+ if(!original_b->is_used())
+ {
+ _impl->weights_manager->mark_as_unused(original_b);
+ }
+ _impl->original_weights->mark_as_used();
+ _impl->weights_manager->release(_impl->original_weights);
+ }
}
}
} // namespace arm_compute