Skip to content

Commit

Permalink
[checkpoint] Revert emitter.py, must have run 'black .' by mistake.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbs-octoml committed Nov 9, 2021
1 parent 4df631b commit 6af66e4
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions python/tvm/micro/contrib/stm32/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@


def _fix_name(node_name):
"""Replace ':' with '_' in names like 'InputImg:0'"""
""" Replace ':' with '_' in names like 'InputImg:0' """
return node_name.replace(":", "_")


Expand Down Expand Up @@ -116,7 +116,7 @@ def _get_tensor_size_bytes(dims, dltype):


def _preprocess_code(src):
"""Hack the C code implementing the model."""
""" Hack the C code implementing the model. """
dst = "#include <stdio.h>\n" "#include <math.h>\n\n"
dst = dst + src
return dst
Expand Down Expand Up @@ -193,7 +193,7 @@ def __init__(self, include_activations=True, include_inputs=True, include_output
self._quantization = {}

def _extract_quantization_info(self, quantization):
"""Build dictionary with quantization infos."""
""" Build dictionary with quantization infos."""

for dl_tensor_name in self._input_data:
if dl_tensor_name in quantization:
Expand Down Expand Up @@ -258,7 +258,7 @@ def _get_tensor_from_node(self, nid, idx):
return tensor

def _compute_data_placement(self):
"""Compute inputs, outputs, weight, activation sizes"""
""" Compute inputs, outputs, weight, activation sizes"""

self._inputs = self._arg_nodes.copy()

Expand Down Expand Up @@ -548,7 +548,7 @@ def parse_module(self, module, quantization=None):
self._parse_model(quantization)

def _emit_params_data(self, name, out_h, out_c):
"""Emits the network_data[c,h] files with parameters."""
""" Emits the network_data[c,h] files with parameters."""

name_upper = name.upper()

Expand Down Expand Up @@ -674,7 +674,7 @@ def _emit_open(self, name, out_h, out_c):
)

def _emit_close(self, name, out_h, out_c):
"""Emits the ai_model_info structure."""
""" Emits the ai_model_info structure. """

name_upper = name.upper()

Expand Down Expand Up @@ -794,7 +794,7 @@ def _emit_tensor_quant(self, dl_tensor_name, out_c):
return None

def _emit_tensor_init(self, dl_tensor_name, tensor, out_c):
"""Emits the tensor instantiation code."""
""" Emits the tensor instantiation code. """

dltype = tensor["dltype"]
dims = tensor["dims"]
Expand Down Expand Up @@ -838,7 +838,7 @@ def _emit_tensor_init(self, dl_tensor_name, tensor, out_c):

def _emit_activation_buffers(self, name, out_c):
# pylint: disable=unused-argument
"""Emits activation tensors, including inputs/outputs."""
""" Emits activation tensors, including inputs/outputs."""

out_c.write(
textwrap.dedent(
Expand Down Expand Up @@ -905,7 +905,7 @@ def _emit_activation_buffers(self, name, out_c):
out_c.write(f"\n")

def _emit_params_buffers(self, name, out_c):
"""Emits all parameter tensors."""
""" Emits all parameter tensors."""

out_c.write(
textwrap.dedent(
Expand All @@ -922,7 +922,7 @@ def _emit_params_buffers(self, name, out_c):
out_c.write(f"\n")

def _emit_network(self, name, out_c):
"""Emits prototypes for the network operator functions."""
""" Emits prototypes for the network operator functions."""

out_c.write(
textwrap.dedent(
Expand Down Expand Up @@ -967,7 +967,7 @@ def _emit_tensor_activation(self, dl_tensor_name, tensor, out_c):
)

def _emit_activation_init(self, name, out_c):
"""Emits buffer initialization code for activation tensors."""
""" Emits buffer initialization code for activation tensors."""

out_c.write(
textwrap.dedent(
Expand Down Expand Up @@ -1015,7 +1015,7 @@ def _emit_activation_init(self, name, out_c):
)

def _emit_params_init(self, name, out_c):
"""Emits buffer initialization code for params tensors."""
""" Emits buffer initialization code for params tensors."""

out_c.write(
textwrap.dedent(
Expand Down Expand Up @@ -1063,13 +1063,13 @@ def _emit_params_init(self, name, out_c):
)

def _emit_init(self, name, out_c):
"""Emits buffer initialization code."""
""" Emits buffer initialization code."""

self._emit_activation_init(name, out_c)
self._emit_params_init(name, out_c)

def _emit_run(self, name, out_h, out_c):
"""Emits the run function code."""
""" Emits the run function code."""

out_h.write(
textwrap.dedent(
Expand Down Expand Up @@ -1230,7 +1230,7 @@ def _emit_run(self, name, out_h, out_c):
out_c.write(f"\n")

def _emit_create_destroy(self, name, out_h, out_c):
"""Emits the create/destroy functions."""
""" Emits the create/destroy functions."""

out_h.write(
textwrap.dedent(
Expand Down Expand Up @@ -1296,7 +1296,7 @@ def _emit_create_destroy(self, name, out_h, out_c):
)

def emit_code(self, dest_dir, model_name):
"""Emits the C code implementing the model."""
""" Emits the C code implementing the model. """

# Build the directory structure
if os.path.exists(dest_dir):
Expand Down

0 comments on commit 6af66e4

Please sign in to comment.