Chapter 8 Actor Critic numpy array to tensor error #51
Unanswered
dalyeach
asked this question in
TensorFlow2
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks so much for the actor critic example! I'm running it on my Windows10 machine in Jupyter Notebook, using the exact code as updated 4 days ago, but I'm getting this error:
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray).
The relevant error messaging is this - thanks for any help.
ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_26584/1145791794.py in
5 num_episodes = 2 # Increase number of episodes to train
6 # Set render=True to visualize Agent's actions in the env
----> 7 train(agent, env, num_episodes, render=False)
~\AppData\Local\Temp/ipykernel_26584/2767962642.py in train(agent, env, episodes, render)
17
18 while not done:
---> 19 action = agent.get_action(state)
20 next_state, reward, done, _ = env.step(action)
21 loss = agent.learn(state, action, reward, next_state, done)
~\AppData\Local\Temp/ipykernel_26584/616427506.py in get_action(self, state)
13
14 def get_action(self, state):
---> 15 _, action_probabilities = self.actor_critic(np.array([state]))
16 action_probabilities = tf.nn.softmax(action_probabilities)
17 action_probabilities = action_probabilities.numpy()
Beta Was this translation helpful? Give feedback.
All reactions