From 17846ffcf0a3b54bbc3ab7270b9f53733a79f2b4 Mon Sep 17 00:00:00 2001 From: Hashim Sharif <hsharif3@miranda.cs.illinois.edu> Date: Mon, 1 Feb 2021 00:55:39 -0600 Subject: [PATCH] Bug fixes in json generation --- hpvm/projects/keras/frontend/approxhpvm_translator.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hpvm/projects/keras/frontend/approxhpvm_translator.py b/hpvm/projects/keras/frontend/approxhpvm_translator.py index da4464ee1b..59bc0d17c0 100644 --- a/hpvm/projects/keras/frontend/approxhpvm_translator.py +++ b/hpvm/projects/keras/frontend/approxhpvm_translator.py @@ -248,7 +248,7 @@ class TensorRtTranslator: flops = weights.shape[0] * weights.shape[1] DEBUG ("dense_flops = ", flops) - self.json_str += "\"linear_" + str(self.op_count) + "\" : " + str(flops) + "\n" + self.json_str += "\"linear_" + str(self.op_count) + "\" : " + str(flops) + ", \n" self.knobs_str += "\"linear_" + str(self.op_count) + "\" : [" + baseline_knobs + "], \n" self.op_count += 1 @@ -951,20 +951,20 @@ class TensorRtTranslator: f = open(dir_prefix + "/tuner.json", "w+") f.write("{ \n\n") - op_cost_str = " \"op_cost\" = { \n" + op_cost_str = " \"op_cost\" : { \n" op_cost_str += self.json_str[:-3] #f.write(self.json_str) - op_cost_str += "\n } \n\n" + op_cost_str += "\n }, \n\n" f.write(op_cost_str) knobs_speedup_str = "\n \"knob_speedup\" : { \n" for key in knobs_speedups: knobs_speedup_str += "\"" + str(key) + "\" : " + str(knobs_speedups[key]) + ", \n" - f.write(knobs_speedup_str[:-3] + "\n} \n\n") + f.write(knobs_speedup_str[:-3] + "\n}, \n\n") - layer_knobs_str = " \"op_knobs\" = { \n" + layer_knobs_str = " \"op_knobs\" : { \n" layer_knobs_str += self.knobs_str[:-3] layer_knobs_str += " \n\n } \n\n" f.write(layer_knobs_str) -- GitLab