Skip to content

Commit a5194a2

Browse files
Rogerluonickrobinson251
andauthored
Update src/grad.jl
Co-Authored-By: Nick Robinson <npr251@gmail.com>
1 parent 1326704 commit a5194a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/grad.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Approximate the gradient of `f` at `xs...` using `fdm`. Assumes that `f(xs...)`
1717
function grad end
1818

1919
function grad(fdm, f, x::AbstractArray{T}) where T
20-
dx, tmp = similar(x), similar(x)
20+
dx = similar(x)
21+
tmp = similar(x)
2122
for k in eachindex(x)
2223
dx[k] = fdm(zero(T)) do ϵ
2324
tmp .= x

0 commit comments

Comments
 (0)