dnn_6_new.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:stock_dqn_f 作者: wdy06 项目源码 文件源码
def Q_func(self, state):
        if state.ndim == 2:
            agent_state = state[:, - self.agent_state_dim :]
            market_state = state[:,:self.market_state_dim]

        elif state.ndim == 3:
            agent_state = state[:, :,- self.agent_state_dim :]
            market_state = state[:,:,:self.market_state_dim]

        a_state = Variable(agent_state)
        m_state = Variable(market_state)
        a = F.tanh(self.a1(a_state))
        a = F.tanh(self.a2(a))
        a = F.tanh(self.a3(a))
        m = F.tanh(self.s1(m_state))
        m = F.tanh(self.s2(m))
        m = F.tanh(self.s3(m))
        new_state = F.concat((a, m), axis=1)

        h = F.tanh(self.fc4(new_state))
        h = F.tanh(self.fc5(h))
        Q = self.q_value(h)

        return Q
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号