Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

fix ddpg to support tensorflow 2 #18

Merged
merged 1 commit into from
May 7, 2020
Merged

Conversation

nicolenair
Copy link
Contributor

I noticed that ddpg.py was not fully functional. Specifically, when running with tensorflow 2.0.1, we get TypeError: len is not well defined for symbolic Tensors. (activation_3/Identity:0) Please call x.shape rather than len(x) for shape information. Based on #9 regarding removing shape assertions for dqn.py, I removed the shape assertions for ddpg.py as well. Next, I removed mentions of 'uses_learning_phase' attribute of Keras layers as this attribute does not seem to exist (see #16). I also disabled eager execution. Whilst this would not be ideal in regular implementations using Tensorflow 2.0, I noticed that it is implicitly disabled within compile() in dqn.py as well (by running tf.executing_eagerly() within the function) and figured it would not do much harm here.

These fixes should make ddpg.py fully functional (as tested on ddpg_pendulum.py).

Copy link
Owner

@inarikami inarikami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

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

Successfully merging this pull request may close these issues.

2 participants