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

unsupported operand type(s) for +: 'dict_values' and 'list #51

Closed
tygrer opened this issue Apr 20, 2018 · 3 comments
Closed

unsupported operand type(s) for +: 'dict_values' and 'list #51

tygrer opened this issue Apr 20, 2018 · 3 comments

Comments

@tygrer
Copy link

tygrer commented Apr 20, 2018

When I use python3.6 to implement the program, the error shows :

Traceback (most recent call last):
File "main.py", line 70, in
tf.app.run()
File "/home/tanggy/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "main.py", line 62, in main
agent = Agent(config, env, sess)
File "/home/tanggy/Downloads/DQN-tensorflow-master/dqn/agent.py", line 30, in init
self.build_dqn()
File "/home/tanggy/Downloads/DQN-tensorflow-master/dqn/agent.py", line 328, in build_dqn
self._saver = tf.train.Saver(self.w.values() + [self.step_op], max_to_keep=30)
TypeError: unsupported operand type(s) for +: 'dict_values' and 'list

@tygrer tygrer closed this as completed Apr 20, 2018
@tennenboke
Copy link

Hi,I met the same problem.How did you fix it?Thank for your replay.

@liziyan16
Copy link

@tennenboke @tygrer Hi, I met the same problem when using python 3.5 and don't know how to fix it. Looking forward to your replay, thanks!

@douglasrizzo
Copy link

Hi everyone. I am fairly sure that this is the source of the problem. In Python 2, dict.values() returns a list, but in Python 3 it returns a "view", which I'm not sure what it is. I just tested and it's possible to cast the return of dict.values() to a list. Maybe someone can test a fix like this one:

self._saver = tf.train.Saver(list(self.w.values()) + [self.step_op], max_to_keep=30)

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

4 participants