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

当所有env都done时会报错 #33

Open
BillyTann opened this issue Apr 11, 2024 · 1 comment
Open

当所有env都done时会报错 #33

BillyTann opened this issue Apr 11, 2024 · 1 comment

Comments

@BillyTann
Copy link

老师好,首先向您的工作致以敬意!
当所有env都done时,会运行到这句代码:位于xuance/torch/runners/runner_pettingzoo.py文件的第219-220行,

if done_n[h][i_env].all():
    mas_group.memory.finish_path(0.0, i_env)

这个被置为0.0的值会引发位于xuance/common/memory_tools_marl.py文件中,finish_path()函数中该语句的报错:

vs = np.append(np.array(self.data['values'][i_env, path_slice]), [value], axis=0)

报错内容为:ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 3 dimension(s) and the array at index 1 has 1 dimension(s)
为了解决这个维数不匹配的问题,需要在vs = np.append(...)语句之前添加:

if value == 0.0:
    value = [[0.0]]

如此即可解决这个问题。

@wenzhangliu
Copy link
Collaborator

Thank you very much for your valuable suggestions. We will enhance the code by carefully addressing the issues you raised.

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

2 participants