in benchmarking/frameworks/tflite/tflite.py [0:0]
def _collectOperatorLatency(self, results, rows, i):
row = rows[i]
if (
row[:71]
== "============================== Run Order =============================="
):
i = i + 2
types_table = {}
pattern = re.compile(
r"\s+(\w+)\s+([\d|\.]+)\s+([\d|\.]+)\s+([\d|\.]+)\s+([\d|\.]+)%\s+([\d|\.]+)%\s+([\d|\.]+)\s+([\d|\.]+)\s+\[(.+)\]"
)
while i < len(rows):
row = rows[i]
match = pattern.match(row)
if not match:
break
type = match.group(9)
kind = match.group(1)
avg = float(match.group(4)) * 1000
results[type + " latency"] = {
"type": type,
"unit": "us",
"metric": "latency",
"summary": {"mean": avg},
}
if kind in types_table:
types_table[kind] += avg
else:
types_table[kind] = avg
i = i + 1
# Write the accumulated operator types
for k in types_table:
v = types_table[k]
results[k + " latency"] = {
"type": k,
"unit": "us",
"metric": "latency",
"summary": {"mean": v},
}
return i