in benchmarking/frameworks/tflite/tflite.py [0:0]
def _collectNETLatency(self, results, rows, i):
row = rows[i]
if row[:21] == "Running benchmark for":
assert len(rows) > i + 1, "Valid row cannot be found"
i = i + 1
data = rows[i]
pattern = re.compile(
r"^count=([\d|\.]+) first=([\d|\.]+) curr=([\d|\.]+) min=([\d|\.]+) max=([\d|\.]+) avg=([\d|\.]+) std=([\d|\.]+)"
)
match = pattern.match(data)
if match:
r = {
"count": int(match.group(1)),
"min": float(match.group(4)),
"max": float(match.group(5)),
"avg": float(match.group(6)),
"std": float(match.group(7)),
}
else:
pattern = re.compile(r"^count=(\d+) curr=(\d+)")
match = pattern.match(data)
assert match, "No data is collected for {}".format(data)
r = {
"count": int(match.group(1)),
"min": float(match.group(2)),
"max": float(match.group(2)),
"avg": float(match.group(2)),
"std": 0,
}
results["NET latency"] = {
"type": "NET",
"unit": "us",
"metric": "latency",
"num_runs": r["count"],
"summary": {
"p0": r["min"],
"p100": r["max"],
"mean": r["avg"],
"stdev": r["std"],
},
}
i = i + 1
return i