mirror of
https://github.com/wassname/DeepRL.git
synced 2026-09-11 11:53:01 +08:00
Merge branch 'master' into finding_nans
This commit is contained in:
@@ -159,6 +159,7 @@ class GaussianActorNet(nn.Module, BasicNet):
|
||||
return self.forward(x)
|
||||
|
||||
def log_density(self, x, mean, log_std, std):
|
||||
<<<<<<< HEAD
|
||||
# x is action
|
||||
# https://github.com/reinforceio/tensorforce/blob/master/tensorforce/core/distributions/gaussian.py#L85
|
||||
# same as tensorforce but max instead of + eps
|
||||
@@ -168,6 +169,10 @@ class GaussianActorNet(nn.Module, BasicNet):
|
||||
log_density = - 0.5 * sq_mean_distance / sq_stddev \
|
||||
- 0.5 * torch.log(2 * Variable(torch.FloatTensor([np.pi])).expand_as(x))\
|
||||
- log_std
|
||||
=======
|
||||
var = std.pow(2)
|
||||
log_density = -(x - mean).pow(2) / (2 * var + 1e-5) - 0.5 * torch.log(2 * Variable(torch.FloatTensor([np.pi])).expand_as(x)) - log_std
|
||||
>>>>>>> master
|
||||
return log_density.sum(1)
|
||||
|
||||
def entropy(self, std):
|
||||
|
||||
Reference in New Issue
Block a user