JuliaGPU/CUDA.jl

CUDNN convolution incorrect for small images

Open

#848 geöffnet am 19. Apr. 2021

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Julia (274 Forks)batch import
good first issueneeds tests

Repository-Metriken

Stars
 (1.408 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 5h) (16 gemergte PRs in 30 T)

Beschreibung

The CUDNN convolution is giving incorrect results for small images, e.g.

julia> f(k, x, padding) = CUDA.CUDNN.cudnnConvolutionForward(CuArray(Float32.(k)),
                                                             CuArray(Float32.(x)),
                                                             padding=padding)
f (generic function with 1 method)

julia> size(f(rand(7, 1, 1, 1), rand(5, 5, 1, 1), 5))
(9, 15, 1, 1)  # Correct

julia> size(f(rand(7, 1, 1, 1), rand(3, 5, 1, 1), 5))
(3, 15, 1, 1)  # Should have been (7, 15, 1, 1)

julia> size(f(rand(7, 1, 1, 1), rand(1, 5, 1, 1), 5))
ERROR: CUDNNError: CUDNN_STATUS_BAD_PARAM (code 3)  # Should have been (5, 15, 1, 1)

The cause of the problem can be located to

https://github.com/JuliaGPU/CUDA.jl/blob/445081cf78a250941b2ecdef1a3a2ecead3fec44/lib/cudnn/convolution.jl#L157-L162

where the min silently changes the requested padding.

Cc: @denizyuret

Contributor Guide