1
1
"""
2
- Upsample(mode= :nearest; scale= nothing, size= nothing)
2
+ Upsample(mode = :nearest; scale = nothing, size = nothing)
3
3
4
4
An upsampling layer.
5
5
6
6
`scale` is a number or a tuple of numbers
7
7
representing the output rescaling factor along each spatial dimension.
8
8
For integer `scale`, all but the last 2 dimensions (channel and batch)
9
- will rescaled by the same factor.
9
+ will be rescaled by the same factor.
10
10
11
11
It is also possible to directly specify the output spatial `size`,
12
12
as an alternative to using `scale`.
@@ -19,13 +19,13 @@ and corresponding NNlib's methods are:
19
19
# Examples
20
20
21
21
```juliarepl
22
- julia> m = Upsample(scale= (2, 3))
22
+ julia> m = Upsample(scale = (2, 3))
23
23
Upsample(:nearest, scale=(2, 3))
24
24
25
25
julia> m(ones(2, 2, 1, 1)) |> size
26
26
(4, 6, 1, 1)
27
27
28
- julia> m = Upsample(:bilinear, size= (4, 5))
28
+ julia> m = Upsample(:bilinear, size = (4, 5))
29
29
Upsample(:bilinear, size=(4, 5))
30
30
31
31
julia> m(ones(2, 2, 1, 1)) |> size
@@ -36,7 +36,7 @@ struct Upsample{Mode,S,T}
36
36
size:: T
37
37
end
38
38
39
- function Upsample (mode:: Symbol = :nearest ; scale= nothing , size= nothing )
39
+ function Upsample (mode = :nearest ; scale = nothing , size = nothing )
40
40
mode in [:nearest , :bilinear ] ||
41
41
throw (ArgumentError (" mode=:$mode is not supported." ))
42
42
if ~ ((scale === nothing ) ⊻ (size === nothing ))
61
61
function Base. show (io:: IO , u:: Upsample{mode} ) where {mode}
62
62
print (io, " Upsample(" )
63
63
print (io, " :" , mode)
64
- u. scale != = nothing && print (io, " , scale= $(u. scale) " )
65
- u. size != = nothing && print (io, " , size= $(u. size) " )
64
+ u. scale != = nothing && print (io, " , scale = $(u. scale) " )
65
+ u. size != = nothing && print (io, " , size = $(u. size) " )
66
66
println (io, " )" )
67
67
end
68
68
79
79
80
80
(m:: PixelShuffle )(x) = NNlib. pixel_shuffle (x, m. r)
81
81
82
-
0 commit comments