Skip to content

Commit 4c5f827

Browse files
committed
Remove allocation in '∇upsample_linear'
1 parent 5e6cd97 commit 4c5f827

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/upsample.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ function ∇upsample_linear(Δ::AbstractArray{T,N}; size::NTuple{<:Any,Integer},
248248
if Base.size(Δ)[1:N-2] == size
249249
return Δ
250250
end
251-
dx = zero(similar(Δ, T, size..., Base.size(Δ)[end-1:end]...))
251+
dx = fill!(similar(Δ, T, size..., Base.size(Δ)[end-1:end]...), zero(T))
252252
return ∇upsample_linear_kernel!(dx, Δ; align_corners)
253253
end
254254

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ end
7878
end
7979
end
8080

81-
@testset "NNlib.jl" begin
81+
@testset "Tests" begin
8282
if get(ENV, "NNLIB_TEST_CUDA", "false") == "true"
8383
using CUDA
8484
if CUDA.functional()

0 commit comments

Comments
 (0)