NFC: Replace "toco" with "converter" in loggings.

The testing is for both MLIR-based and TOCO based converters.
Calling these "toco" is confusing

PiperOrigin-RevId: 351158814
Change-Id: If659d97a2b38feee980d9533db83e73b6798e2d1
This commit is contained in:
Yu-Cheng Ling 2021-01-11 08:26:45 -08:00 committed by TensorFlower Gardener
parent 9a7c57d1d8
commit 28602b1084
2 changed files with 16 additions and 15 deletions

View File

@ -37,11 +37,11 @@ def make_report_table(fp, title, reports):
title: "Title of the zip file this pertains to."
reports: a list of conversion attempts. (report_args, report_vals) i.e.
({"shape": [1,2,3], "type": "tf.float32"},
{"tf": "SUCCESS", "toco": "FAILURE", "toco_log": "Unsupported type.",
"tf_log": ""})
{"tf": "SUCCESS", "converter": "FAILURE",
"converter_log": "Unsupported type.", "tf_log": ""})
"""
# sort reports by if TOCO failure and then TF failure (reversed)
reports.sort(key=lambda x: x[1]["toco"], reverse=False)
reports.sort(key=lambda x: x[1]["converter"], reverse=False)
reports.sort(key=lambda x: x[1]["tf"], reverse=True)
def result_cell(x, row, col):
"""Produce a cell with the condition string `x`."""
@ -76,9 +76,10 @@ log.innerHTML = "<pre>" + data[row][col] + "</pre>";
}
""")
fp.write("var data = \n")
fp.write(json.dumps([[html.escape(x[1]["tf_log"], quote=True),
html.escape(x[1]["toco_log"], quote=True)]
for x in reports]))
logs = json.dumps([[html.escape(x[1]["tf_log"], quote=True),
html.escape(x[1]["converter_log"], quote=True)
] for x in reports])
fp.write(logs)
fp.write(";</script>\n")
# Write the main table and use onclick on the items that have log items.
@ -110,7 +111,7 @@ log.innerHTML = "<pre>" + data[row][col] + "</pre>";
fp.write(" <td>%s</td>\n" % html.escape(repr(params[p]), quote=True))
result_cell(vals["tf"], idx, 0)
result_cell(vals["toco"], idx, 1)
result_cell(vals["converter"], idx, 1)
fp.write("</tr>\n")
fp.write("</table>\n")
fp.write("</div>\n")

View File

@ -422,11 +422,11 @@ def make_zip_of_tests(options,
"""
np.random.seed(RANDOM_SEED)
report = {"toco": report_lib.NOTRUN, "tf": report_lib.FAILED}
report = {"converter": report_lib.NOTRUN, "tf": report_lib.FAILED}
# Build graph
report["tf_log"] = ""
report["toco_log"] = ""
report["converter_log"] = ""
tf.reset_default_graph()
with tf.Graph().as_default():
@ -446,7 +446,7 @@ def make_zip_of_tests(options,
ValueError):
report["tf_log"] += traceback.format_exc()
return None, report
report["toco"] = report_lib.FAILED
report["converter"] = report_lib.FAILED
report["tf"] = report_lib.SUCCESS
# Convert graph to toco
input_tensors = [(input_tensor.name.split(":")[0], input_tensor.shape,
@ -468,10 +468,10 @@ def make_zip_of_tests(options,
output_tensors,
extra_toco_options=extra_toco_options,
test_params=param_dict_real)
report["toco"] = (
report["converter"] = (
report_lib.SUCCESS
if tflite_model_binary is not None else report_lib.FAILED)
report["toco_log"] = toco_log
report["converter_log"] = toco_log
if options.save_graphdefs:
archive.writestr(zip_path_label + ".pbtxt",
@ -507,7 +507,7 @@ def make_zip_of_tests(options,
_, report = build_example(label, param_dict, zip_path_label)
if report["toco"] == report_lib.FAILED:
if report["converter"] == report_lib.FAILED:
ignore_error = False
if not options.known_bugs_are_errors:
for pattern, bug_number in options.known_bugs.items():
@ -517,7 +517,7 @@ def make_zip_of_tests(options,
if not ignore_error:
toco_errors += 1
print("-----------------\nconverter error!\n%s\n-----------------\n" %
report["toco_log"])
report["converter_log"])
convert_report.append((param_dict, report))
@ -541,7 +541,7 @@ def make_zip_of_tests(options,
tf_success = sum(
1 for x in convert_report if x[1]["tf"] == report_lib.SUCCESS)
toco_success = sum(
1 for x in convert_report if x[1]["toco"] == report_lib.SUCCESS)
1 for x in convert_report if x[1]["converter"] == report_lib.SUCCESS)
percent = 0
if tf_success > 0:
percent = float(toco_success) / float(tf_success) * 100.