class_docstr: Code emitter class.
class_docstr_tok: ["Code","emitter","class","."]
code: def _emit_tensor_quant(self, dl_tensor_name, out_c):
      if dl_tensor_name in self._quantization:
          quantization = self._quantization[dl_tensor_name]
  
      # At this time, TVM only supports quantization info with
      # single output models.
      elif (
          dl_tensor_name in self._output_data
          and "output" in self._quantization.keys()
      ):
          quantization = self._quantization["output"]
      else:
          quantization = None
  
      if quantization is not None:
          scale = quantization["scale"]
          zero_point = quantization["zero_point"]
  
          # Sometimes we get a scalar with ScaleAsNumpy.
          # This seem to mean not quantized ?
          if not isinstance(scale, np.ndarray):
              assert (
                  scale == 0.0
              ), f"Non-quantized tensor with scale != 0.0"
              assert (
                  not isinstance(zero_point, np.ndarray)
                  and zero_point == 0
              ), f"Non-quantized tensor with zero_point != 0"
              return None
  
          scale_size = len(scale)
          zero_point_size = len(zero_point)
  
          assert len(scale) == len(
              zero_point
          ), f"Inconsistent quantizations scale:{scale} vs zero-point:{zero_point}"
  
          if len(scale) == 1:
              quant_name = dl_tensor_name + "_quant"
  
              out_c.write(
                  f"AI_STATIC float {quant_name}_scale[{scale_size}] = {{ "
              )
              for val in scale:
                  out_c.write(f"{val}, ")
              out_c.write(f"}};\n")
              out_c.write(
                  f"AI_STATIC int32_t {quant_name}_zero_point[{zero_point_size}] = {{ "
              )
              for val in zero_point:
                  out_c.write(f"{val}, ")
              out_c.write(f"}};")
              out_c.write(
                  textwrap.dedent(
                      f"""
                  AI_STATIC ai_quantization_info {quant_name} = {{
                    .scale = {quant_name}_scale,
                    .zero_point = {quant_name}_zero_point,
                    .dim = -1
                  }};
                  """
                  )
              )
  
              return quant_name
  
      return None
  
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 14 for calling the CodeEmitter obj's underlying member method code with example usage: obj._emit_tensor_quant(dl_tensor_name, out_c) and returns: None, None, quant_name