class_docstr: Code emitter class.
class_docstr_tok: ["Code","emitter","class","."]
docstr: Emits the network_data[c,h] files with parameters.
docstr_tok: ["Emits","the","network_data","[","c",",","h","]","files","with","parameters","."]
code: def _emit_params_data(self, name, out_h, out_c):
      """Emits the network_data[c,h] files with parameters."""
  
      name_upper = name.upper()
  
      # XXX_data.h
  
      out_h.write(
          textwrap.dedent(
              f"""\
          #ifndef __{name_upper}_DATA_H_
          #define __{name_upper}_DATA_H_
  
          #include \"ai_runtime_api.h\"
  
          AI_API_ENTRY
          const ai_ptr ai_{name}_data_weights_get (void);
  
          #endif /* __{name_upper}_DATA_H_ */
          """
          )
      )
  
      # XXX_data.cc
  
      out_c.write(
          textwrap.dedent(
              f"""
          #include \"{name}_data.h\"
  
          const ai_ptr ai_{name}_data_weights_get (void)
          {{
            AI_ALIGNED({self.DATA_ALIGNMENT_BYTES}) static const __attribute__ ((section(\".nn_weights\"))) uint8_t s_{name}_weights[] = {{
          """
          )
      )
  
      # Weights are arranged in the order of 'params_'
      offset = 0
  
      for key in self._params:
          data = self._params[key]  # ND Array
          npdata = data.asnumpy()
          blob = npdata.tobytes()
  
          out_c.write(f'// "{key}": \n')
          out_c.write(f"\t")
  
          count = 0
  
          # Align by emitting garbage between un-aligned data
          dl_tensor_name = get_input_tensor_name(key)
          tensor = self._weights[dl_tensor_name]
          tensor_offset = tensor["offset"]
          tensor_size = tensor["size"]
  
          while offset < tensor_offset:
              count += 1
              out_c.write("0x{:02X}, ".format(0))
              if count == 12:
                  out_c.write("\n\t")
                  count = 0
              offset += 1
  
          for val in blob:
              count += 1
              out_c.write("0x{:02X}, ".format(val))
              if count == 12:
                  out_c.write("\n\t")
                  count = 0
  
          offset += tensor_size
  
          out_c.write(f"\n")
  
      out_c.write(
          textwrap.dedent(
              f"""\
            }};
            return (const ai_ptr)s_{name}_weights;
          }}
          """
          )
      )
  
imports: import contextlib
  import json
  import os
  import re
  import shutil
  import tarfile
  import textwrap
  from datetime import datetime
  import numpy
  import tvm
  from tvm.contrib import utils
label_desc: Use image node_id 10 for calling the CodeEmitter obj's underlying member method code with example usage: obj._emit_params_data(name, out_h, out_c) without return types