Skip to content

Commit 1dba5db

Browse files
fix cat
1 parent 82e30c5 commit 1dba5db

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/upsample.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,12 @@ function ∇bilinear_upsample(Δ::AbstractArray{<:Number, 4}, k::NTuple{2,Int})
120120

121121
kern1 = get_downsamplekernel(Δ, k[1])
122122
kern2 = get_downsamplekernel(Δ, k[2])
123-
kern = kern1 .* kern2'
123+
kern = kern1 * kern2'
124124

125125
pad = (floor(Int, k[1]//2), floor(Int, k[2]//2))
126126
stride = k
127127

128-
weight = similar(Δ, eltype(Δ), (size(kern)..., n_chan, n_chan))
129-
weight .= 0
130-
for i in 1:n_chan
131-
weight[:,:,i,i] .= kern
132-
end
133-
# weight = cat(fill(kern, n_chan), dims=(3,4)) # produces Array{Any}, revisit in the future
134-
128+
weight = cat(fill(kern, n_chan)..., dims=(3,4))
135129
dx = conv(Δ, weight, pad=pad, stride=stride)
136130

137131
# Still have to fix edge effects due to zero-padding of convolution,

0 commit comments

Comments
 (0)