Skip to content

Commit 0e36af9

Browse files
authored
Fix loading of pooling layers (#2598)
* Fix loading of MaxPool layers * Move to deprecations, add more layers * Fix comment
1 parent 046fe45 commit 0e36af9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/deprecations.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,10 @@ end
168168
# """
169169
# ))
170170

171+
# In Flux <= v0.14, pooling layers contained no state.
172+
# These workarounds allow such pooling layers to be loaded in Flux >= v0.16.
173+
# (https://github.com/FluxML/Flux.jl/pull/2598)
174+
loadmodel!(dst::MaxPool{N, M}, src::Tuple{}; kw...) where {N, M} = dst
175+
loadmodel!(dst::MeanPool{N, M}, src::Tuple{}; kw...) where {N, M} = dst
176+
loadmodel!(dst::AdaptiveMaxPool{S, O}, src::Tuple{}; kw...) where {S, O} = dst
177+
loadmodel!(dst::AdaptiveMeanPool{S, O}, src::Tuple{}; kw...) where {S, O} = dst

0 commit comments

Comments
 (0)