AI4Finance-Foundation / AI4Finance-Foundation/ElegantRL

Bug Of Agent init

未关闭
#225 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Python
星标
4.4k
派生
978
PR 合并指标
30 天内没有已合并 PR

描述

in the AgentBase.py AgentBase.__init__() :
```python
class AgentBase:
def __init__(self, net_dim: int, state_dim: int, action_dim: int, gpu_id: int = 0, args: Arguments = None):
...
'''network'''
act_class = getattr(self, "act_class", None)
cri_class = getattr(self, "cri_class", None)
self.act = act_class(net_dim, self.num_layer, state_dim, action_dim).to(self.device)
self.cri = cri_class(net_dim, self.num_layer, state_dim, action_dim).to(self.device) \
if cri_class else self.act
```

the code pass the num_layer when init the act ,but in the agent/net.py, most of the networks __init__ not receive num_layer param,
such as QNetTwinDuel:
```python
class QNetTwinDuel(nn.Module): # D3QN: Dueling Double DQN

def __init__(self, mid_dim, state_dim, action_dim):
super().__init__()
self.net_state = nn.Sequential(
nn.Linear(state_dim, mid_dim),
nn.ReLU(),
nn.Linear(mid_dim, mid_dim),
nn.ReLU(),
)
```
this will cause agent init error.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。