Skip to content

Commit 0180656

Browse files
authored
Merge pull request #61 from maleadt/tb/1.0
Fixes for 0.7 and 1.0.
2 parents 97800cc + f527928 commit 0180656

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/impl/pool.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function mean_pooling2d_bwd!(x::AbstractArray{T,4}, y::AbstractArray{T,4},
9999
pooled_height::Int, kernel_w::Int, kernel_h::Int, pad_w::Int, pad_h::Int,
100100
stride_w::Int, stride_h::Int) where T
101101

102-
x[:, :, :, :] = 0
102+
x[:, :, :, :] .= 0
103103
kernel_size = kernel_w * kernel_h
104104

105105
#pragma omp parallel for
@@ -112,7 +112,7 @@ function mean_pooling2d_bwd!(x::AbstractArray{T,4}, y::AbstractArray{T,4},
112112
wstart = max(wstart, 0) + 1
113113

114114
oval = y[pw, ph, c, n] / kernel_size
115-
x[wstart:wend, hstart:hend, c, n] += oval
115+
x[wstart:wend, hstart:hend, c, n] .+= oval
116116
end
117117
end
118118

@@ -263,7 +263,7 @@ function mean_pooling3d_bwd!(grad_input::AbstractArray{T,5}, grad_output::Abstra
263263
hstart = max(hstart, 0) + 1
264264
wstart = max(wstart, 0) + 1
265265

266-
grad_input[wstart:wend, hstart:hend, dstart:dend, c, n] += grad_output[pw, ph, pd, c, n] / kernel_size
266+
grad_input[wstart:wend, hstart:hend, dstart:dend, c, n] .+= grad_output[pw, ph, pd, c, n] ./ kernel_size
267267
end
268268
end
269269

src/softmax.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ softmax!(xs) = softmax!(xs, xs)
2929
softmax(xs) = softmax!(similar(xs), xs)
3030

3131
function ∇softmax!(out::AbstractVecOrMat, Δ::AbstractVecOrMat, xs::AbstractVecOrMat)
32-
s = sum(exp, xs, 1)
33-
out .= exp.(xs)./s.*.- sum.* exp.(xs), 1)./s)
32+
s = sum(exp, xs, dims=1)
33+
out .= exp.(xs)./s.*.- sum.* exp.(xs), dims=1)./s)
3434
end
3535

3636
∇softmax!(Δ, xs) = ∇softmax!(Δ, Δ, xs)

0 commit comments

Comments
 (0)