Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'name' #269

Closed
jackchinor opened this issue Jun 25, 2018 · 6 comments
Closed

AttributeError: 'NoneType' object has no attribute 'name' #269

jackchinor opened this issue Jun 25, 2018 · 6 comments
Assignees

Comments

@jackchinor
Copy link

Platform (like ubuntu 16.04/win10):
ubuntu 14.04

Python version:2.7

Source framework with version (like Tensorflow 1.4.1 with GPU):

Destination framework with version (like CNTK 2.3 with GPU):

Pre-trained model path (webpath or webdisk path):

Running scripts:
File "/home/shyf/anaconda2/envs/tensorflow/bin/mmtoir", line 11, in
sys.exit(_main())
File "/home/shyf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/mmdnn/conversion/_script/convertToIR.py", line 184, in _main
ret = _convert(args)
File "/home/shyf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/mmdnn/conversion/_script/convertToIR.py", line 102, in _convert
parser.run(args.dstPath)
File "/home/shyf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/mmdnn/conversion/common/DataStructure/parser.py", line 22, in run
self.gen_IR()
File "/home/shyf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/mmdnn/conversion/tensorflow/tensorflow_parser.py", line 311, in gen_IR
func(current_node)
File "/home/shyf/anaconda2/envs/tensorflow/lib/python2.7/site-packages/mmdnn/conversion/tensorflow/tensorflow_parser.py", line 646, in rename_FusedBatchNorm
self.set_weight(source_node.name, 'scale', self.ckpt_data[scale.name])
AttributeError: 'NoneType' object has no attribute 'name'
(tensorflow) shyf@SHYFSer:~/work/goodix_qxg/tf2/checkpoint_autoenc_0531_SSIMAdam$

when I convert my own tensorflow model to IR file, there is a problem happens , Can anyone help me figure it out?
Thanks!

@JiahaoYao
Copy link
Contributor

Hi @jackchinor ,
If you follow the Meta File Graph Visualization here, you can probably visualize your graph.

If the batchnorm layer is like this, then it can be easily converted.
image

However, if the batchnorm layer is like this, it needs more steps.

image

That is because the mmdnn uses the input information to build the graph.

For the first type, its input is like this:
image

In contrast, for the second type, its input is like this
image

I think that is why AttributeError: 'NoneType' object has no attribute 'name' .

@JiahaoYao
Copy link
Contributor

In this situation, if there is a is_training parameter and set it to False and then reload and dump the model, this might reduce the second type to the first type of batchnorm.

@namizzz namizzz closed this as completed Jul 5, 2018
@criminalking
Copy link

Hi @JiahaoYao ,
I also encountered the same problem. Could you please share some sample codes of the solution you mentioned above? I'm a newbie in tensorflow. Really appreciate your help!

@asa008
Copy link

asa008 commented May 7, 2019

Hi, @JiahaoYao , @jackchinor , @criminalking
I have met almost the same problem, could you tell me how to solve it?

  File "c:\users\qjhs\appdata\local\programs\python\python36\lib\site-packages\mmdnn\conversion\tensorflow\tensorflow_parser.py", line 420, in gen_IR
    func(current_node)
  File "c:\users\qjhs\appdata\local\programs\python\python36\lib\site-packages\mmdnn\conversion\tensorflow\tensorflow_parser.py", line 810, in rename_FusedBatchNorm
    self.set_weight(source_node.name, 'mean', self.ckpt_data[mean.name])
AttributeError: 'NoneType' object has no attribute 'name'

Thank you

@machanic
Copy link

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

@machanic
Copy link

I posted an issue here: #925

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants