Skip to content
Snippets Groups Projects
Commit dbe81220 authored by Elizabeth's avatar Elizabeth
Browse files

Added time/energy labels for headers and fixed quantization data to be at the end

parent 3727ea6f
No related branches found
No related tags found
No related merge requests found
...@@ -139,7 +139,7 @@ class TableGenerator: ...@@ -139,7 +139,7 @@ class TableGenerator:
# Get each operation in the layer # Get each operation in the layer
ops_in_layer = [] ops_in_layer = []
header = ["**", layer_name, str(num_ops), "_"] header = ["**", layer_name, str(num_ops)]
for op_in_layer_count in range(num_ops): for op_in_layer_count in range(num_ops):
# Each line consists of operation name # Each line consists of operation name
...@@ -147,17 +147,51 @@ class TableGenerator: ...@@ -147,17 +147,51 @@ class TableGenerator:
curr_op = [curr_line] # Join into a string later curr_op = [curr_line] # Join into a string later
operation_data = self.__table[curr_line] operation_data = self.__table[curr_line]
h2f_data = [None] * 2
f2h_data = [None] * 2
has_h2f_field = False
has_f2h_field = False
# Iterate through time/energy data for each approx type # Iterate through time/energy data for each approx type
for approx_type in operation_data: for approx_type in operation_data:
curr_op.append(operation_data[approx_type]["time"]) op_time = operation_data[approx_type]["time"]
curr_op.append(operation_data[approx_type]["energy"]) op_energy = operation_data[approx_type]["energy"]
# CRITICAL ASSUMPTION: All ops within a layer have the same # cols if approx_type == "h2f":
# Only fill out the header once for the layer h2f_data[0] = op_time
if op_in_layer_count == 0: h2f_data[1] = op_energy
header.append(approx_type) has_h2f_field = True
elif approx_type == "f2h":
f2h_data[0] = op_time
f2h_data[1] = op_energy
has_f2h_field = True
else:
curr_op.append(op_time)
curr_op.append(op_energy)
# CRITICAL ASSUMPTION: All ops within a layer have the same # cols
# Only fill out the header once for the layer
if op_in_layer_count == 0:
header.append("%s_time" % approx_type)
header.append("%s_energy" % approx_type)
# Guarantee that the quantization data is at the end of the col
# TODO: How essential is this bc it increases the complexity of my code
if has_h2f_field:
curr_op.append(' '.join(h2f_data))
if has_f2h_field:
curr_op.append(' '.join(f2h_data))
ops_in_layer.append(' '.join(curr_op)) ops_in_layer.append(' '.join(curr_op))
# update header with h2f/f2h cols if they exist
if has_h2f_field:
header.append("h2f_time")
header.append("h2f_energy")
if has_f2h_field:
header.append("f2h_time")
header.append("f2h_energy")
# Getting all operation rows and then writing everything because # Getting all operation rows and then writing everything because
# calls to write() are slow (memory vs time tradeoff) # calls to write() are slow (memory vs time tradeoff)
print("%s" % ' '.join(header)) print("%s" % ' '.join(header))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment