MCPcopy Create free account
hub / github.com/XiaoMi/mace / convert_ops

Method convert_ops

tools/python/transform/megengine_converter.py:206–229  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

204 dilation_arg.ints.extend(dilation)
205
206 def convert_ops(self):
207 for mge_op in self._mge_operators:
208 opr_type = mgb.cgtools.get_opr_type(mge_op)
209
210 # some reshape operators provide data for batchnorm
211 if opr_type == "Reshape":
212 output = mge_op.outputs[0]
213 next_ops = self._mge_var2oprs[output.id]
214 if len(next_ops) == 1:
215 (next_op_id, _) = next_ops[0]
216 next_op = self._mge_map_oprs[next_op_id]
217
218 if mgb.cgtools.get_opr_type(next_op) == "BatchNormForward":
219 self._skip_tensors.update(
220 [inp.name for inp in mge_op.inputs])
221 # using output name to address input symbol var
222 self._bn_statistis_tensors[mge_op.outputs[0].name] = \
223 mge_op.inputs[0]
224 # skip this reshape op
225 continue
226
227 self._op_converters[opr_type](mge_op)
228
229 self.convert_tensors()
230
231 def add_tensor(self, name, shape, data_type, value):
232 tensor = self._mace_net_def.tensors.add()

Callers 1

runMethod · 0.95

Calls 1

convert_tensorsMethod · 0.95

Tested by

no test coverage detected