We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 95d7782 + 8f655de commit f4a77c0Copy full SHA for f4a77c0
src/pooling.jl
@@ -110,7 +110,8 @@ for backend in (Symbol(), :_direct, :_im2col)
110
@timeit_debug to function $(Symbol("$(name)$(backend)"))(
111
x::AbstractArray{xT,N},
112
pdims::PoolDims; kwargs...) where {xT, N}
113
- y = zeros(xT, output_size(pdims)..., channels_out(pdims), size(x, N))
+ y = similar(x, output_size(pdims)..., channels_out(pdims), size(x, N))
114
+ fill!(y, xT(0))
115
return $(Symbol("$(name)$(backend)!"))(y, x, pdims; kwargs...)
116
end
117
@@ -119,7 +120,8 @@ for backend in (Symbol(), :_direct, :_im2col)
119
120
dy::AbstractArray{T,N}, y::AbstractArray{T,N},
121
x::AbstractArray{T,N}, pdims::PoolDims;
122
kwargs...) where {T, N}
- dx = zeros(T, input_size(pdims)..., channels_in(pdims), size(dy, N))
123
+ dx = similar(x, input_size(pdims)..., channels_in(pdims), size(dy, N))
124
+ fill!(dx, T(0))
125
return $(Symbol("∇$(name)$(backend)!"))(dx, dy, y, x, pdims; kwargs...)
126
127
0 commit comments