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

ValueError: Shapes (31, 1) and (31, 2) are incompatible #28

Open
Sanketd420 opened this issue May 26, 2020 · 2 comments
Open

ValueError: Shapes (31, 1) and (31, 2) are incompatible #28

Sanketd420 opened this issue May 26, 2020 · 2 comments

Comments

@Sanketd420
Copy link

loss = update_network(network, rewards, states, actions, num_actions)

loss = network.train_on_batch(states, discounted_rewards)
@Joe-Darling
Copy link

I also had this issue. If you are on tensorflow 2.2 then downgrading to either 2.0 or 2.1 may fix the issue, it did for me at least. However after fixing that issue the model never converges and after thousands of episodes still gets stuck on a reward value of about 10-20 and an avg loss in the negative thousands... Not sure how to fix this

@asokraju
Copy link

adding these lines will fix the issue...
target_actions = np.array([[1 if a==i else 0 for i in range(2)] for a in actions]) loss = network.train_on_batch(states,target_actions, sample_weight=discounted_rewards)

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

3 participants