简体   繁体   English

'tensorflow.python.framework.ops.EagerTensor' 对象没有属性 'squeeze'

[英]'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.我正在尝试使用 huskarl 并将演示文件加载到测试我已正确安装所有内容。 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() self.target_critic.predict_on_batch([target_actions, np.array(non_final_last_next_states)]).squeeze()

Try to use tf.squeeze() or np.squeeze()尝试使用tf.squeeze()np.squeeze()

So I figured out that huskarl is only compatible with tensorflow==2.0.0a0.所以我发现 huskarl 只与 tensorflow==2.0.0a0 兼容。 I found that out by uninstall tf and reinstalling it and catching an error.我通过卸载 tf 并重新安装它并捕获错误发现了这一点。 :/ :/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError: &#39;tensorflow.python.framework.ops.EagerTensor&#39; 对象没有属性 &#39;to_tensor&#39; - AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'to_tensor' AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object 没有属性 'ravel' - AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'ravel' AttributeError: &#39;tensorflow.python.framework.ops.EagerTensor&#39; 对象没有属性 &#39;decode&#39; - AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'decode' 'tensorflow.python.framework.ops.EagerTensor' object 没有属性 '_in_graph_mode' - 'tensorflow.python.framework.ops.EagerTensor' object has no attribute '_in_graph_mode' 类型 &#39;tensorflow.python.framework.ops.EagerTensor&#39; 没有 len() - type 'tensorflow.python.framework.ops.EagerTensor' has no len() TypeError: &#39;tensorflow.python.framework.ops.EagerTensor&#39; 对象不支持项目分配 - TypeError: 'tensorflow.python.framework.ops.EagerTensor' object does not support item assignment 项目分配 Tensorflow 2.0 - TypeError: 'tensorflow.python.framework.ops.EagerTensor' object 不支持项目分配 - Item Assignment Tensorflow 2.0 - TypeError: 'tensorflow.python.framework.ops.EagerTensor' object does not support item assignment 类型错误:<tf.tensor: shape ...> 有类型<class 'tensorflow.python.framework.ops.eagertensor'> ,但预期其中之一:(<class 'int'> ,)</class></class></tf.tensor:> - TypeError: <tf.Tensor: shape ... > has type <class 'tensorflow.python.framework.ops.EagerTensor'>, but expected one of: (<class 'int'>,) AttributeError:模块“ tensorflow.contrib.learn.python.learn.ops”没有属性“ split_squeeze” - AttributeError: module 'tensorflow.contrib.learn.python.learn.ops' has no attribute 'split_squeeze' AttributeError: 模块“tensorflow.python.framework.ops”没有属性“RegisterShape” - AttributeError: module 'tensorflow.python.framework.ops' has no attribute 'RegisterShape'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM