FluxML / Gym.jl

Gym environments in Julia
MIT License
54 stars 19 forks source link

Fixed the DQN example and added Base.length to discrete #29

Closed kraftpunk97-zz closed 5 years ago

kraftpunk97-zz commented 5 years ago

The DQN example for the CartPole environment and the environment itself has been updated to stop converting the actions (Discrete(2)) to (-1, 1). Function inv_action has been discarded. ~Please make corresponding changes in the model-zoo as well.~ Changes proposed to the model-zoo version with this PR.

kraftpunk97-zz commented 5 years ago

@tejank10 Made the requested changes. Please review.

kraftpunk97-zz commented 5 years ago

Check

kraftpunk97-zz commented 5 years ago

@tejank10 I looked into the internal error I got with the DiffRL.jl example (Present in this gist) So, it all comes down to line 90 of the CartPole environment which is...

done =  !(all(vcat(-env.x_threshold .≤ x_ .≤ env.x_threshold, -env.θ_threshold_radians .≤ θ_ .≤ env.θ_threshold_radians)))

Any clue as to why this doesn't sit right with Zygote?