ElegantRL icon indicating copy to clipboard operation
ElegantRL copied to clipboard

TypeError: unsupported operand type(s) for -: 'NoneType' and 'Parameter'

Open marcuswang6 opened this issue 8 months ago • 0 comments

~/anaconda3/envs/ai4finance/lib/python3.8/site-packages/elegantrl/agents/AgentBase.py in explore_one_env(self, env, horizon_len, if_random) 91 get_action = self.act.get_action 92 for t in range(horizon_len): ---> 93 action = torch.rand(1, self.action_dim) * 2 - 1.0 if if_random else get_action(state) 94 states[t] = state 95

~/anaconda3/envs/ai4finance/lib/python3.8/site-packages/elegantrl/agents/net.py in get_action(self, state) 200 201 def get_action(self, state: Tensor) -> Tensor: # for exploration --> 202 state = self.state_norm(state) 203 action = self.net(state).tanh() 204 noise = (torch.randn_like(action) * self.explore_noise_std).clamp(-0.5, 0.5)

~/anaconda3/envs/ai4finance/lib/python3.8/site-packages/elegantrl/agents/net.py in state_norm(self, state) 184 185 def state_norm(self, state: Tensor) -> Tensor: --> 186 return (state - self.state_avg) / self.state_std 187 188

marcuswang6 avatar Feb 20 '25 04:02 marcuswang6