DDPG-Keras-Torcs icon indicating copy to clipboard operation
DDPG-Keras-Torcs copied to clipboard

ValueError: Shapes (3, ?, 1) and () are incompatible

Open agusvgomez opened this issue 5 years ago • 4 comments

I'm getting this error when I run ddpg.py:

Traceback (most recent call last): File "ddpg.py", line 162, in playGame() File "ddpg.py", line 52, in playGame actor = ActorNetwork(sess, state_dim, action_dim, BATCH_SIZE, TAU, LRA) File "/home/marmesto/DDPG-Keras-Torcs/ActorNetwork.py", line 25, in init self.model , self.weights, self.state = self.create_actor_network(state_size, action_size)
File "/home/marmesto/DDPG-Keras-Torcs/ActorNetwork.py", line 54, in create_actor_network V = merge([Steering,Acceleration,Brake],mode='concat')
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1528, in merge name=name) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1188, in init self.add_inbound_node(layers, node_indices, tensor_indices) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 572, in add_inbound_node Node.create_node(self, inbound_layers, node_indices, tensor_indices) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 154, in create_node output_tensors = to_list(outbound_layer.call(input_tensors, mask=input_masks)) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1275, in call return K.concatenate(inputs, axis=self.concat_axis) File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 716, in concatenate return tf.concat(axis, [to_dense(x) for x in tensors]) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/dispatch.py", line 180, in wrapper return target(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1297, in concat tensor_shape.scalar()) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_shape.py", line 1103, in assert_is_compatible_with raise ValueError("Shapes %s and %s are incompatible" % (self, other)) ValueError: Shapes (3, ?, 1) and () are incompatible

agusvgomez avatar Jul 12 '19 19:07 agusvgomez

i have this problem before, it seems the tensorflow version is not compatable, then i change the tensorflow to 0.12, then it fixed.

404hasbeenfound avatar Jul 22 '19 02:07 404hasbeenfound

I have this problem ,and my tensorflow is 1.12.0. can you tell me your tensorflow(0.12?)Specific version ?or how to solve it?thanks!

legobill avatar Dec 04 '19 07:12 legobill

@legobill you can run:

pip install tensorflow==0.12

hildebrandt-carl avatar Feb 13 '20 17:02 hildebrandt-carl

谢谢,已经搞定了

------------------ 原始邮件 ------------------ 发件人: "Carl Hildebrandt"<[email protected]>; 发送时间: 2020年2月14日(星期五) 凌晨1:43 收件人: "yanpanlau/DDPG-Keras-Torcs"<[email protected]>; 抄送: "花花世界.个人自由自在"<[email protected]>; "Mention"<[email protected]>; 主题: Re: [yanpanlau/DDPG-Keras-Torcs] ValueError: Shapes (3, ?, 1) and () are incompatible (#61)

@legobill you can run: pip install tensorflow==0.12
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

legobill avatar Mar 12 '20 14:03 legobill