code: def save_model_to_code(
      namespace,
      model,
      params,
      model_checksum,
      params_checksum,
      output,
      gencode_params,
  ):
      util.mkdir_p(output)
      cwd = os.path.dirname(__file__)
      j2_env = Environment(
          loader=FileSystemLoader(cwd + "/template"), trim_blocks=True
      )
      j2_env.filters["stringfy"] = stringfy
  
      graph_size = len(model.net_def)
      for i in range(graph_size):
          save_graph_to_code(
              j2_env, namespace, i, model.net_def[i], output
          )
  
      if gencode_params:
          template_name = "tensor_data.jinja2"
          source = j2_env.get_template(template_name).render(
              model_tag=namespace,
              model_data_size=len(params),
              model_data=params,
          )
          with open(output + "/tensor_data.cc", "w") as f:
              f.write(source)
  
      # generate model source files
      build_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
      template_name = "model.jinja2"
      checksum = "{},{}".format(model_checksum, params_checksum)
      source = j2_env.get_template(template_name).render(
          multi_net=model,
          model_tag=namespace,
          checksum=checksum,
          build_time=build_time,
      )
      with open(output + "/model.cc", "w") as f:
          f.write(source)
  
      template_name = "model_header.jinja2"
      source = j2_env.get_template(template_name).render(
          model_tag=namespace
      )
      with open(output + "/" + namespace + ".h", "w") as f:
          f.write(source)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import datetime
  import os
  import hashlib
  from jinja2 import Environment, FileSystemLoader
  from py_proto import mace_pb2
  from utils import device
  from utils import util
  from utils.util import mace_check
  from utils.util import MaceLogger
  from utils import config_parser
  from utils.config_parser import CPP_KEYWORDS
  from transform.base_converter import MaceKeyword
label_desc: Use image node_id 7 for calling a global function with example usage: save_model_to_code(namespace, model, params, model_checksum, params_checksum, output, gencode_params) without return types