code: def gen_code(self, phase="test"):
      self.phase = phase
      self.add_body(0, self.header_code)
  
      # for test
      # with open("graph.txt", 'w') as f:
      #     for layer in self.IR_graph.topological_sort:
      #         current_node = self.IR_graph.get_node(layer)
      #         print("========current_node=========\n{}".format(current_node.layer), file=f)
      # test end
  
      for layer in self.IR_graph.topological_sort:
          current_node = self.IR_graph.get_node(layer)
          node_type = current_node.type
          # print("========current_node={}".format(current_node.layer))
  
          if hasattr(self, "emit_" + node_type):
              func = getattr(self, "emit_" + node_type)
              func(current_node)
          else:
              print(
                  "CaffeEmitter has not supported operator [%s]."
                  % (node_type)
              )
              self.emit_UNKNOWN(current_node)
  
      self.add_body(0, "")
      self.add_body(0, self.end_code)
  
      return self.body_code
  
imports: from __future__ import division
  import os
  import sys
  import math
  import numpy
  import caffe
  from caffe import layers
  from caffe import params
  from mmdnn.conversion.common.IR.IR_graph import IRGraph, IRGraphNode
  import mmdnn.conversion.common.IR.graph_pb2
  from mmdnn.conversion.common.IR.graph_pb2 import NodeDef, GraphDef, DataType
  from mmdnn.conversion.common.DataStructure.emitter import Emitter
  from mmdnn.conversion.common.utils import *
label_desc: Use image node_id 4 for calling the CaffeEmitter obj's underlying member method code with example usage: obj.gen_code(phase) and returns: self