Skip to content

Commit b8d155b

Browse files
committed
functor dropout and alphadropout
1 parent 97ec9f1 commit b8d155b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/layers/normalise.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ function Dropout(p; dims=:, rng = Random.default_rng())
7878
Dropout(p, dims, nothing, rng)
7979
end
8080

81+
@functor Dropout
82+
83+
trainable(a::Dropout) = ()
84+
8185
function (a::Dropout)(x)
8286
_isactive(a) || return x
8387
return dropout(a.rng, x, a.p; dims=a.dims, active=true)
@@ -114,6 +118,10 @@ end
114118
AlphaDropout(p, active) = AlphaDropout(p, active, Random.default_rng())
115119
AlphaDropout(p; rng = Random.default_rng()) = AlphaDropout(p, nothing, rng)
116120

121+
@functor AlphaDropout
122+
123+
trainable(a::AlphaDropout) = ()
124+
117125
function (a::AlphaDropout)(x::AbstractArray{T}) where T
118126
_isactive(a) || return x
119127
p = a.p

0 commit comments

Comments
 (0)