简体   繁体   中英

'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?

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()

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. :/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM