Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运用动态图的DDPG代码model部分报错ValueError: (InvalidArgument) The shape of input[0] and input[1] is expected to be equal.But received input[0]'s shape = [48, 8], input[1]'s shape = [48, 1, 2]. #1110

Open
lzlbit123 opened this issue Jul 11, 2023 · 0 comments

Comments

@lzlbit123
Copy link

版本都在PARL/examples/tutorials/lesson5/ddpg
/model.py 这里,代码也在这里借鉴的,但是运行的时候(不是在carpole环境中,是一个定义的act_dim=2,obs_dim=8的一个环境)
报错:Traceback (most recent call last):
File "C:\Users\lzlbi\PycharmProjects\PPO\train1.py", line 100, in
main()
File "C:\Users\lzlbi\PycharmProjects\PPO\train1.py", line 86, in main
run_train_episode(agent, env, rpm)
File "C:\Users\lzlbi\PycharmProjects\PPO\train1.py", line 38, in run_train_episode
batch_done)
File "C:\Users\lzlbi\PycharmProjects\PPO\agent1.py", line 46, in learn
terminal)
File "C:\Users\lzlbi\PycharmProjects\PPO\alg1.py", line 50, in learn
terminal)
File "C:\Users\lzlbi\PycharmProjects\PPO\alg1.py", line 65, in _critic_learn
current_Q = self.model.value(obs, action)
File "C:\Users\lzlbi\PycharmProjects\PPO\model1.py", line 17, in value
return self.critic_model(obs, action)
File "D:\anaconda\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 914, in call
outputs = self.forward(*inputs, **kwargs)
File "C:\Users\lzlbi\PycharmProjects\PPO\model1.py", line 49, in forward
concat = paddle.concat([obs, act], axis=1)
File "D:\anaconda\envs\paddle\lib\site-packages\paddle\tensor\manipulation.py", line 345, in concat
return paddle.fluid.layers.concat(input=x, axis=axis, name=name)
File "D:\anaconda\envs\paddle\lib\site-packages\paddle\fluid\layers\tensor.py", line 327, in concat
return _C_ops.concat(input, 'axis', axis)
ValueError: (InvalidArgument) The shape of input[0] and input[1] is expected to be equal.But received input[0]'s shape = [48, 8], input[1]'s shape = [48, 1, 2].
[Hint: Expected inputs_dims[i].size() == out_dims.size(), but received inputs_dims[i].size():3 != out_dims.size():2.] (at C:\home\workspace\Paddle_release\paddle/fluid/operators/concat_op.h:40)
[operator < concat > error]
请问是怎么回事呢,看了网上很多例子都是代码差不多的,不知道哪里有问题,如何修改呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant