MMdnn icon indicating copy to clipboard operation
MMdnn copied to clipboard

packages/mmdnn/conversion/tensorflow/tensorflow_parser.py", line 660, in rename_FusedBatchNorm self.set_weight(source_node.name, 'mean', self.ckpt_data[mean.name]) AttributeError: 'NoneType' object has no attribute 'name'

Open IamMegatron2025 opened this issue 7 years ago • 6 comments

hello, when I run

mmconvert -sf tensorflow -in my_model.ckpt.meta -iw my_model.ckpt --dstNodeName xxx -df caffe -om tf_model

it shows error:

  File "/xxx/anaconda2/lib/python2.7/site-packages/mmdnn/conversion/_script/convert.py", line 102, in _main
    ret = convertToIR._convert(ir_args)
  File "/xxx/anaconda2/lib/python2.7/site-packages/mmdnn/conversion/_script/convertToIR.py", line 115, in _convert
    parser.run(args.dstPath)
  File "/xxx/anaconda2/lib/python2.7/site-packages/mmdnn/conversion/common/DataStructure/parser.py", line 22, in run
    self.gen_IR()
  File "/xxx/anaconda2/lib/python2.7/site-packages/mmdnn/conversion/tensorflow/tensorflow_parser.py", line 309, in gen_IR
    func(current_node)
  File "/xxx/anaconda2/lib/python2.7/site-packages/mmdnn/conversion/tensorflow/tensorflow_parser.py", line 660, in rename_FusedBatchNorm
    self.set_weight(source_node.name, 'mean', self.ckpt_data[mean.name])
AttributeError: 'NoneType' object has no attribute 'name'

in my model, I use slim.batch_norm. so this slim.batch_norm causes the error? how should I fix it?

IamMegatron2025 avatar Oct 29 '18 04:10 IamMegatron2025

Hi @IvyGongoogle , probably the 'mean' node is not at the position self.get_parent(source_node.name, [3, 0], True). Please add if mean is None: mean = self.get_parent(source_node.name, [3]) after https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/tensorflow/tensorflow_parser.py#L709 to have a try. Thanks!

rainLiuplus avatar Nov 08 '18 02:11 rainLiuplus

hi, @IvyGongoogle, I have met the same problem, and i've tried @rainLiuplus' method, but doesn't use at all, do you resolve it?

JingzheLyp avatar Apr 08 '19 07:04 JingzheLyp

Hi, @IvyGongoogle , @rainLiuplus , @JingzheLyp I have met the same problem, it seems that code length has changed, where should I add the code 'if mean is None: mean = self.get_parent(source_node.name, [3])' ? Thank you

asa008 avatar May 07 '19 08:05 asa008

Hi @asa008 I have met the same problem,when convert tensorflow to pytorch, do you resolve it? Thank you

arya-none avatar Aug 11 '20 07:08 arya-none

@arya-none @asa008 Do you solve this problem? I encounter the same issue!

machanic avatar Jun 28 '21 12:06 machanic

I posted an issue here: https://github.com/microsoft/MMdnn/issues/925

machanic avatar Jun 28 '21 13:06 machanic