gpt4 book ai didi

c++ - 使用 CUDA 进行循环卷积

转载 作者:行者123 更新时间:2023-11-30 04:26:48 27 4
gpt4 key购买 nike

在FFT2D论文中

http://developer.download.nvidia.com/compute/cuda/2_2/sdk/website/projects/convolutionFFT2D/doc/convolutionFFT2D.pdf

在图 1 和图 2 中声明:

assuming the image is bigger than the convolution kernel, which is usually the case in practice, the convolution kernel needs to be expanded to the image size and padded according to Figure 1. As can be seen on figures 2 and 3 (see below), cyclic convolution with the expanded kernel is equivalent to cyclic convolution with initial convolution kernel.

如果我对一个元素执行内核和图像之间的卷积,并且我尝试对同一元素执行扩展内核和图像之间的卷积,它会产生不同的结果。

我在某处读到“循环卷积”与经典“卷积”相同,这是正确的吗?否则我该如何解释?

最佳答案

不,循环卷积,也称为circular convolution , 与常规卷积不同。内核在循环卷积中“环绕”。

x=[1 2 3 4 5]h=[1 2 3]为例:

首先,翻转 h 并用零填充:h'=[0 0 3 2 1]。然后要获得第一个元素,您可以执行通常的点积:

(x*h)[0] = 0*1 + 0*2 + 3*3 + 2*4 + 1*5

要获得第二个元素,您将内核移动一个并再次点:

(x*h)[1] = 0*1 + 1*2 + 2*3 + 3*4 + 0*5

与第三个相同。但是,为了获得第四个,内核环绕,所以你得到:

(x*h)[3] = 2*1 + 3*2 + 0*3 + 0*4 + 1*5

关于c++ - 使用 CUDA 进行循环卷积,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11316213/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com