MLECO-1226: update pyarmnn profiling helper utility
authorNina Drozd <nina.drozd@arm.com>
Fri, 28 Aug 2020 16:14:49 +0000 (17:14 +0100)
committerNina Drozd <nina.drozd@arm.com>
Tue, 1 Sep 2020 16:31:03 +0000 (16:31 +0000)
* fix key error in get_profiling_data
* make retrieval of inference measurements more generic

Signed-off-by: Nina Drozd <nina.drozd@arm.com>
Change-Id: I3fc147a6a93830b59e8b12f517be9f9c72370c09

python/pyarmnn/src/pyarmnn/_utilities/profiling_helper.py

index c6e0718..ecde040 100644 (file)
@@ -53,8 +53,11 @@ def get_profiling_data(profiler: 'IProfiler') -> ProfilerData:
 
     top_level_dict = json.loads(profiler.as_json())
     armnn_data = top_level_dict["ArmNN"]
-    inference_measurements = armnn_data["inference_measurements_#1"]
-    execution_data = inference_measurements["Execute_#2"]
+    #Get the inference measurements dict, this will be just one value for key starting with "inference_measurements"
+    inference_measurements = [v for k, v in armnn_data.items() if k.startswith("inference_measurements_")][0]
+
+    #Get the execution data dict, this will be just one value for key starting with "Execute_"
+    execution_data = [v for k, v in inference_measurements.items() if k.startswith("Execute_")][0]
 
     workload_data = {}
     inference_data = {}