From 20c2b501f206e4db1c15c2334f9e8a1baf640a50 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Tue, 1 Oct 2019 15:39:42 +0100 Subject: COMPMID-2693 Weights manager to mark the initial weights as unsued Change-Id: Iaa964e71d0aa80fff0a465127ac3716563bbe85f Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/2017 Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- src/runtime/IWeightsManager.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/runtime/IWeightsManager.cpp') diff --git a/src/runtime/IWeightsManager.cpp b/src/runtime/IWeightsManager.cpp index 6dfb925fe6..b367b5f70b 100644 --- a/src/runtime/IWeightsManager.cpp +++ b/src/runtime/IWeightsManager.cpp @@ -85,6 +85,27 @@ ITensor *IWeightsManager::run(const ITensor *weights, ITransformWeights *weights } } + // Check top level weights. If all the transformations are done + // mark the weights as unused + if(_managed_weights_parents.find(weights) == _managed_weights_parents.end()) + { + auto item = _managed_weights.find(weights); + bool mark_as_unused = true; + for(auto it : item->second) + { + if(!it->is_reshape_run()) + { + mark_as_unused = false; + break; + } + } + + if(mark_as_unused) + { + weights->mark_as_unused(); + } + } + return weights_tensor; } -- cgit v1.2.1