Skip to content

Commit d60172f

Browse files
authored
Merge pull request #254 from FluxML/a2/dropblock-update
2 parents eb3f9a4 + 3fd9cad commit d60172f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Metalhead"
22
uuid = "dbeba491-748d-5e0e-a39e-b530a07fa0cc"
3-
version = "0.8.4"
3+
version = "0.9.0"
44

55
[deps]
66
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

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)