Skip to content

Commit f96fe93

Browse files
more tests
1 parent 4f67a9b commit f96fe93

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/optimise.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,21 @@ end
151151
Flux.update!(opt, w, g)
152152
@test w wold .- 0.1
153153

154+
w = randn(3)
155+
wold = copy(w)
156+
θ = Flux.params([w])
157+
gs = gradient(() -> w[1], θ)
158+
opt = Descent(0.1)
159+
Flux.update!(opt, θ, gs)
160+
@test w[1] wold[1] .- 0.1
161+
@test w[2:3] wold[2:3]
162+
154163
## Issue #1550
155164
w = randn(10,10)
156165
wold = copy(w)
157166
θ = Flux.params([w])
158167
gs = gradient(() -> sum(w), θ)
159168
opt = Descent(0.1)
160-
Flux.update!(opt, w, g)
169+
Flux.update!(opt, θ, gs)
161170
@test w wold .- 0.1
162171
end

0 commit comments

Comments
 (0)