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

A3C: Issue with keras.function in optimizer #22

Open
AlconDivino opened this issue Nov 30, 2019 · 4 comments
Open

A3C: Issue with keras.function in optimizer #22

AlconDivino opened this issue Nov 30, 2019 · 4 comments

Comments

@AlconDivino
Copy link

AlconDivino commented Nov 30, 2019

When the optimize function of the actor is called, i get the following error:

Traceback (most recent call last): File "/home/alcon/Desktop/DRL-Python/A3CMain.py", line 41, in <module> A3C(action_dim, env_dim, args.consecutive_frames) File "/home/alcon/Desktop/DRL-Python/A3C/a3cNetwork.py", line 33, in __init__ self.a_opt = self.actor.optimizer() File "/home/alcon/Desktop/DRL-Python/A3C/actor.py", line 39, in optimizer return K.function(inputs=[self.model.input, self.action_pl, self.advantages_pl], outputs=[], updates=updates) File "/home/alcon/Desktop/DRL-Python/venv/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3479, in function return GraphExecutionFunction(inputs, outputs, updates=updates, **kwargs) File "/home/alcon/Desktop/DRL-Python/venv/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3142, in __init__ with ops.control_dependencies([self.outputs[0]]): IndexError: list index out of range

I found code on the internet using it but for some reason it doesn't work for me

I tried it with tensorflow 1.15 - 2.0.0
and tried importing
tensorflow.keras.backend
tensorflow.compat.v1.keras.backend
tensorflow.compat.v2.keras.backend

but none worked

@thangdn3
Copy link

K.function() with output = [] yeild error given the newer version of Keras.
Down-grade it to 2.1.6 like suggested in the README.

@shtse8
Copy link

shtse8 commented Aug 7, 2020

K.function() with output = [] yeild error given the newer version of Keras.
Down-grade it to 2.1.6 like suggested in the README.

I have the same issue.
Besides downgrade, how can we fix?

@yosoul93
Copy link

To fix it without downgrading, outputs=[K.constant([0,1])]

@choasLC
Copy link

choasLC commented Oct 11, 2021

@yosoul93 I think this is helpful

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

5 participants