Skip to content

Commit

Permalink
Fixed error in rectifier.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
mleprovost committed Feb 24, 2024
1 parent a6ba890 commit 6a50621
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/hermitemap/rectifier.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function evaluate!(result, g::Rectifier, x)
vmap!(g.g, result, x)
end

evaluate(g::Rectifier, x) = evaluate!(zero(x), g, x)
vevaluate(g::Rectifier, x) = evaluate!(zero(x), g, x)


function inverse(g::Rectifier, x)
Expand Down
6 changes: 3 additions & 3 deletions src/tools/normal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ export log_pdf, gradlog_pdf, hesslog_pdf
Compute the log of the density of the univariate standard Gaussian distribution (zero mean and unitary standard deviation).
"""
log_pdf(x) = -0.5*(log(2*π) + x^2)
log_pdf(x; σ = 1.0) = -0.5*(log(2*π*σ^2) + (x/σ)^2)

"""
gradlog_pdf(x)
Compute the gradient of the log of the density of the univariate standard Gaussian distribution (zero mean and unitary standard deviation).
"""
gradlog_pdf(x) = -x
gradlog_pdf(x; σ = 1.0) = -x*inv^2)

"""
hesslog_pdf(x)
Compute the hessian of the log of the density of the univariate standard Gaussian distribution (zero mean and unitary standard deviation).
"""
hesslog_pdf(x) = -1.0
hesslog_pdf(x; σ = 1.0) = -inv^2)
2 changes: 0 additions & 2 deletions test/tools/normal.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

@testset "Verify hesslogpdf for a Normal distribution" begin

N = Normal(1.5, 2.3)

Nx = 10
x = randn(Nx)

for i =1:Nx
@test abs(hesslog_pdf(x[i]) - (-1.0))<1e-10
end
Expand Down

0 comments on commit 6a50621

Please sign in to comment.