name 'Normal' is not defined
Opened this issue · 2 comments
Hi,
Thanks for sharing!
I tried to run the code following the guide:
cd raisimLib/raisimGymTorch/raisimGymTorch/env/envs/rsg_a1_task
python runner.py --name random --gpu 1 --exptid 1
However,it seemed that the name "Normal' isn't defined, I guessed it's a class and try to change it from "Normal" to "nn.Normal",but it didn't work.
Here was my output:
/home/jialei/RL/01raisim/raisim_workspace/raisimLib/raisimGymTorch/raisimGymTorch/algo/ppo/module.py:249: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if x.shape[1] > 130:
Traceback (most recent call last):
File "runner.py", line 231, in
action = ppo.observe(obs)
File "/home/jialei/RL/01raisim/raisim_workspace/raisimLib/raisimGymTorch/raisimGymTorch/algo/ppo/ppo.py", line 99, in observe
self.actions, self.actions_log_prob = self.actor.sample(torch.from_numpy(actor_obs).to(self.device))
File "/home/jialei/RL/01raisim/raisim_workspace/raisimLib/raisimGymTorch/raisimGymTorch/algo/ppo/module.py", line 68, in sample
actions, log_prob = self.distribution.sample(logits)
File "/home/jialei/RL/01raisim/raisim_workspace/raisimLib/raisimGymTorch/raisimGymTorch/algo/ppo/module.py", line 374, in sample
self.distribution = Normal(logits, self.std.reshape(self.dim))
NameError: name 'Normal' is not defined
How to deal with it? It's my honor to get your help!
Thanks again!
"nn.Normal"这里我也遇到过,要么在文件最前面加from torch.distributions import Normal,要么把所有的Normal(logits, self.std.reshape(self.dim))都改成torch.distributions.Normal(...)
"nn.Normal"这里我也遇到过,要么在文件最前面加from torch.distributions import Normal,要么把所有的Normal(logits, self.std.reshape(self.dim))都改成torch.distributions.Normal(...)
用第一种方式解决啦,谢谢~和rimsim原位置的文件对比了一下,就是缺少import Normal函数