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_tensors(self):
      for mge_op in self._mge_operators:
          type_opr = mgb.cgtools.get_opr_type(mge_op)
  
          # all tensors generated by SharedDeviceTensor op
          if type_opr == "SharedDeviceTensor":
              output = mge_op.outputs[0]
              if output.name not in self._skip_tensors:
                  nshape = output.imm_shape
                  # tensor used for depthwise conv/deconv should be reshaped
                  for_group_conv = is_consumer_group_conv(
                      output, self._mge_var2oprs, self._mge_map_oprs
                  )
                  if for_group_conv:
                      nshape = (
                          1,
                          output.imm_shape[0],
                          output.imm_shape[3],
                          output.imm_shape[4],
                      )
  
                  self.add_tensor(
                      output.name,
                      nshape,
                      mace_pb2.DT_FLOAT,
                      get_symvar_value(output).flatten(),
                  )
          else:
              # handle all constant values
              for const_tensor in mge_op.inputs:
                  if (
                      const_tensor.inferred_value is not None
                      and const_tensor.name not in self._skip_tensors
                  ):
                      self.add_tensor(
                          const_tensor.name,
                          const_tensor.imm_shape,
                          mace_pb2.DT_INT32,
                          const_tensor.inferred_value.flatten(),
                      )
  
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 7 for calling the MegengineConverter obj's underlying member method code with example usage: obj.convert_tensors() without return types