class_docstr: A class for convert megengine dumped model to mace model.
class_docstr_tok: ["A","class","for","convert","megengine","dumped","model","to","mace","model","."]
code: def convert_general_op(self, mge_op):
      op = self._mace_net_def.op.add()
      op.name = mge_op.name
      op.type = mgb.cgtools.get_opr_type(mge_op)
      op.input.extend([mge_input.name for mge_input in mge_op.inputs])
      op.output.extend(
          [mge_output.name for mge_output in mge_op.outputs]
      )
      for mge_output in mge_op.outputs:
          output_shape = op.output_shape.add()
          output_shape.dims.extend(mge_output.imm_shape)
  
      data_type_arg = op.arg.add()
      data_type_arg.name = "T"
      data_type_arg.i = self._option.data_type
  
      framework_type_arg = op.arg.add()
      framework_type_arg.name = MaceKeyword.mace_framework_type_str
      framework_type_arg.i = FrameworkType.MEGENGINE.value
  
      # check compute format of megengine
      compute_format = DataFormat.NCHW
      try:
          if "format" in mge_op.params.keys():
              compute_format = self.compute_format_type[
                  mge_op.params["format"]
              ]
      except AttributeError:
          compute_format = DataFormat.NCHW
      ConverterUtil.add_data_format_arg(op, compute_format)
  
      return op
  
imports: import os
  import math
  import numpy
  import six
  import megengine._internal
  from enum import Enum
  from py_proto import mace_pb2
  from transform import base_converter
  from transform.base_converter import PoolingType
  from transform.base_converter import ActivationType
  from transform.base_converter import EltwiseType
  from transform.base_converter import FrameworkType
  from transform.base_converter import ReduceType
  from transform.base_converter import DataFormat
  from transform.base_converter import MaceOp
  from transform.base_converter import MaceKeyword
  from transform.base_converter import ConverterUtil
  from transform.base_converter import RoundMode
  from utils.util import mace_check
label_desc: Use image node_id 9 for calling the MegengineConverter obj's underlying member method code with example usage: obj.convert_general_op(mge_op) and returns: op