Ellis Thompson
Ellis Thompson

Reputation: 418

'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'squeeze'

Im an trying to use huskarl and load the demo files to tesnt that I have installed everything correctly. However when I run any of the demo files I am met with this Trace:

Traceback (most recent call last):
  File "ddpg-pendulum.py", line 48, in <module>
    sim.train(max_steps=30_000, visualize=True, plot=plot_rewards)
  File "C:\Users\Project Apollo\AppData\Local\Programs\Python\Python37\lib\site-packages\huskarl\simulation.py", line 32, in train
    self._sp_train(max_steps, instances, visualize, plot)
  File "C:\Users\Project Apollo\AppData\Local\Programs\Python\Python37\lib\site-packages\huskarl\simulation.py", line 66, in _sp_train
    self.agent.train(step)
  File "C:\Users\Project Apollo\AppData\Local\Programs\Python\Python37\lib\site-packages\huskarl\agent\ddpg.py", line 101, in train
    target_qvals[non_final_mask] = self.target_critic.predict_on_batch([target_actions, np.array(non_final_last_next_states)]).squeeze()
AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'squeeze'

Any Idea what has gne wrong?

Upvotes: 1

Views: 5660

Answers (2)

Pogger
Pogger

Reputation: 382

Error is in squeeze function used at the end

self.target_critic.predict_on_batch([target_actions, np.array(non_final_last_next_states)]).squeeze()

Try to use tf.squeeze() or np.squeeze()

Upvotes: 2

Ellis Thompson
Ellis Thompson

Reputation: 418

So I figured out that huskarl is only compatible with tensorflow==2.0.0a0. I found that out by uninstall tf and reinstalling it and catching an error. :/

Upvotes: 0

Related Questions