Skip to content

Commit a24d759

Browse files
committed
Update docstrings of Recur and PixelShuffle
1 parent 142918e commit a24d759

File tree

2 files changed

+58
-6
lines changed

2 files changed

+58
-6
lines changed

src/layers/recurrent.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ julia> rnn(3)
8080
julia> rnn.state
8181
5
8282
83-
julia> rnn.(1:10) # apply to a sequence
83+
julia> rnn(1:10) # apply to a sequence
8484
10-element Vector{Int64}:
8585
1
8686
2
@@ -118,7 +118,12 @@ julia> rnn.state
118118
1×1 Matrix{Int64}:
119119
5
120120
121-
julia> rnn(reshape(1:10, 1, 1, :)) # apply to a sequence of (features, batch, time)
121+
julia> vec = rnn(reshape(1:10, 1, 1, :)); # apply to a sequence of (features, batch, time)
122+
123+
julia> size(vec)
124+
(1, 1, 10)
125+
126+
julia> vec
122127
1×1×10 Array{Int64, 3}:
123128
[:, :, 1] =
124129
1

src/layers/upsample.jl

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,57 @@ See [`NNlib.pixel_shuffle`](@ref).
8484
```jldoctest
8585
julia> p = PixelShuffle(2);
8686
87-
julia> xs = rand(2, 2, 4, 1); # an image with 4 channels having 2X2 pixels in each channel
88-
89-
julia> p(xs) |> size # upsampled image with only 1 channel
90-
(4, 4, 1, 1)
87+
julia> xs = [2row + col + channel/10 for row in 1:2, col in 1:2, channel in 1:4, n in 1:1]
88+
2×2×4×1 Array{Float64, 4}:
89+
[:, :, 1, 1] =
90+
3.1 4.1
91+
5.1 6.1
92+
93+
[:, :, 2, 1] =
94+
3.2 4.2
95+
5.2 6.2
96+
97+
[:, :, 3, 1] =
98+
3.3 4.3
99+
5.3 6.3
100+
101+
[:, :, 4, 1] =
102+
3.4 4.4
103+
5.4 6.4
104+
105+
julia> p(xs)
106+
4×4×1×1 Array{Float64, 4}:
107+
[:, :, 1, 1] =
108+
3.1 3.3 4.1 4.3
109+
3.2 3.4 4.2 4.4
110+
5.1 5.3 6.1 6.3
111+
5.2 5.4 6.2 6.4
112+
113+
julia> xs = [3row + col + channel/10 for row in 1:2, col in 1:3, channel in 1:4, n in 1:1]
114+
2×3×4×1 Array{Float64, 4}:
115+
[:, :, 1, 1] =
116+
4.1 5.1 6.1
117+
7.1 8.1 9.1
118+
119+
[:, :, 2, 1] =
120+
4.2 5.2 6.2
121+
7.2 8.2 9.2
122+
123+
[:, :, 3, 1] =
124+
4.3 5.3 6.3
125+
7.3 8.3 9.3
126+
127+
[:, :, 4, 1] =
128+
4.4 5.4 6.4
129+
7.4 8.4 9.4
130+
131+
julia> p(xs)
132+
4×6×1×1 Array{Float64, 4}:
133+
[:, :, 1, 1] =
134+
4.1 4.3 5.1 5.3 6.1 6.3
135+
4.2 4.4 5.2 5.4 6.2 6.4
136+
7.1 7.3 8.1 8.3 9.1 9.3
137+
7.2 7.4 8.2 8.4 9.2 9.4
91138
```
92139
"""
93140
struct PixelShuffle

0 commit comments

Comments
 (0)