mirror of
https://github.com/wassname/DeepRL.git
synced 2026-09-09 11:13:47 +08:00
moving epsilon outside softplus
I think you intended this to be outside the softplus. The reason is that it should be applied just before the log to avoid `log(0)=inf`.e.g. - `log(softplus(-1000+1e-5))=log(0)=inf`. - `log(softplus(-1000)+1e-5)=log(1e-5)!=inf`. Also this fixes a NaN I had.
This commit is contained in:
@@ -145,7 +145,7 @@ class GaussianActorNet(nn.Module, BasicNet):
|
||||
log_std = self.action_log_std.expand_as(mean)
|
||||
std = log_std.exp()
|
||||
else:
|
||||
std = F.softplus(self.action_std(phi) + 1e-5)
|
||||
std = F.softplus(self.action_std(phi)) + 1e-5
|
||||
log_std = std.log()
|
||||
return mean, std, log_std
|
||||
|
||||
|
||||
Reference in New Issue
Block a user