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: 'list' object has no attribute 'op' #2

Open
gaopenggang opened this issue Apr 15, 2018 · 4 comments
Open

AttributeError: 'list' object has no attribute 'op' #2

gaopenggang opened this issue Apr 15, 2018 · 4 comments

Comments

@gaopenggang
Copy link

gao@ubuntu14:~/py_work/DBN/Tensorflow_deep-belief-network-master/test$ python3 classification_MINST.py
Extracting ../dataset/MNIST_data/train-images-idx3-ubyte.gz
Extracting ../dataset/MNIST_data/train-labels-idx1-ubyte.gz
Extracting ../dataset/MNIST_data/t10k-images-idx3-ubyte.gz
Extracting ../dataset/MNIST_data/t10k-labels-idx1-ubyte.gz
Traceback (most recent call last):
File "classification_MINST.py", line 42, in
rbm_lr=1e-3)
File "../models/dbn.py", line 47, in init
self.build_model()
File "../models/dbn.py", line 89, in build_model
self.train_batch_bp=_optimization.trainer(algorithm=self.bp_algorithm).minimize(self.loss, var_list=self.parameter_list)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/optimizer.py", line 288, in minimize
grad_loss=grad_loss)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/optimizer.py", line 346, in compute_gradients
processors = [_get_processor(v) for v in var_list]
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/optimizer.py", line 346, in
processors = [_get_processor(v) for v in var_list]
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/optimizer.py", line 115, in _get_processor
if v.op.type == "ReadVariableOp":
AttributeError: 'list' object has no attribute 'op'
could you tell me how to resolve it? Thanks

@zhuofupan
Copy link
Owner

zhuofupan commented Apr 15, 2018

I think it may be caused by different version, because i don't have that problem.
My development environment is Anaconda3+spyder 3.2.7+tensorflow1.2.1 (My computer don't have GPU, so I don't try tensorflow-gpu ).
In the code 'var_list=self.parameter_list' , I set the struct of 'parameter_list' like this:
[[W_1 ,b_1],[W_2 , b_2],...,[W_out, b_out]] , which may cause your problem.
It's can be solved by transforming 'parameter_list' to [ W_1 ,b_1,W_2 , b_2,...,W_out, b_out ](='new_parameter_list') . Just setting a new list 'new_parameter_list' and let 'var_list=new_parameter_list'.
Wish this method can solve your problem!

@zhuofupan
Copy link
Owner

I have changed the struct of 'parameter_list'. You can download new code and try again~

@gaopenggang
Copy link
Author

Thank you so much. It works.

@zhuofupan
Copy link
Owner

I fixed some bug again

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

2 participants