You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dropout! function will seed the global RNG when called with a seed argument, leading to unexpected deterministic behavior further on in program execution once the function has returned. For example, the following code will always return the same result even though the second call to dropout does not set the seed argument:
julia>using Knet
julia>let
a = Float64[n for n in1:10]
dropout(a, .2, drop=true, seed=1)
dropout(a, .2, drop=true)
end10-element Array{Float64,1}:1.252.53.755.06.257.58.750.011.2512.5
julia>let
a = Float64[n for n in1:10]
dropout(a, .2, drop=true, seed=1)
dropout(a, .2, drop=true)
end10-element Array{Float64,1}:1.252.53.755.06.257.58.750.011.2512.5
This also means that other uses of randomness become implicitly re-seeded at the point of the call to dropout, leading (for example) to the following two independent calls to rand to return the same results:
julia>using Knet
julia>let
a = Float64[n for n in1:10]
dropout(a, .2, drop=true, seed=1)
rand_1 =rand(10)
dropout(a, .2, drop=true, seed=1)
rand_2 =rand(10)
rand_1 == rand_2
endtrue
As a separate issue, if zero is passed as the seed then no seed will be set at all:
The
dropout!
function will seed the global RNG when called with aseed
argument, leading to unexpected deterministic behavior further on in program execution once the function has returned. For example, the following code will always return the same result even though the second call todropout
does not set theseed
argument:This also means that other uses of randomness become implicitly re-seeded at the point of the call to
dropout
, leading (for example) to the following two independent calls torand
to return the same results:As a separate issue, if zero is passed as the seed then no seed will be set at all:
Knet.jl/src/ops20/dropout.jl
Lines 45 to 46 in f1de18b
The text was updated successfully, but these errors were encountered: