Skip to content

Commit 71b79fb

Browse files
committed
Update use of Flux._isactive in DropBlock
1 parent eb3f9a4 commit 71b79fb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/layers/drop.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,11 @@ ChainRulesCore.@non_differentiable _dropblock_checks(x, drop_block_prob, gamma_s
9090

9191
function (m::DropBlock)(x)
9292
_dropblock_checks(x, m.drop_block_prob, m.gamma_scale)
93-
return Flux._isactive(m) ?
94-
dropblock(m.rng, x, m.drop_block_prob, m.block_size, m.gamma_scale) : x
93+
return dropblock(m.rng, x, m.drop_block_prob * Flux._isactive(m, x), m.block_size, m.gamma_scale)
9594
end
9695

9796
function Flux.testmode!(m::DropBlock, mode = true)
98-
return (m.active = (isnothing(mode) || mode === :auto) ? nothing : !mode; m)
97+
return (m.active = isnothing(Flux._tidy_active(mode)) ? nothing : !mode; m)
9998
end
10099

101100
function DropBlock(drop_block_prob = 0.1, block_size::Integer = 7, gamma_scale = 1.0,

0 commit comments

Comments
 (0)