采用Intel MKL 3D卷积卷积、Intel、MKL

2023-09-08 10:31:39 作者:只為ㄋ遇見你

我想计算的三维阵列中采用了英特尔 MKL 3D卷积。可能有人请给我一些提示我怎么能做到这一点?难道是可以实现的使用 MKL ?先谢谢了。

I am trying to compute 3D convolution of a 3D array using Intel MKL. Could someone kindly give me some hints how I can do that? Is it achievable using MKL? Thanks in advance.

推荐答案

英特尔为例在3D FFT自己的页面,这应该是由乘法频率空间进行卷积很有帮助。对不起,我没有一个完整的解决方案:

Intel has an example on their page of a 3D FFT, which should be helpful for performing convolution by multiplication in frequency space. Sorry I don't have a full solution:

三维实景FFT(C接口)

#include "mkl_dfti.h"
float x[32][100][19];
float _Complex y[32][100][10]; /* 10 = 19/2 + 1 */
DFTI_DESCRIPTOR_HANDLE my_desc_handle;
MKL_LONG status, l[3];
MKL_LONG strides_out[4];

//...put input data into x[j][k][s] 0<=j<=31, 0<=k<=99, 0<=s<=18
l[0] = 32; l[1] = 100; l[2] = 19;

strides_out[0] = 0; strides_out[1] = 1000;
strides_out[2] = 10; strides_out[3] = 1;

status = DftiCreateDescriptor( &my_desc_handle, DFTI_SINGLE,
DFTI_REAL, 3, l );
status = DftiSetValue(my_desc_handle,
DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX);
status = DftiSetValue( my_desc_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE );
status = DftiSetValue(my_desc_handle,
DFTI_OUTPUT_STRIDES, strides_out);

status = DftiCommitDescriptor(my_desc_handle);
status = DftiComputeForward(my_desc_handle, x, y);
status = DftiFreeDescriptor(&my_desc_handle);
/* result is the complex value z(j,k,s) 0<=j<=31; 0<=k<=99, 0<=s<=9
and is stored in complex matrix y in CCE format. */

接下来的步骤是不执行的填充内核,这两个复杂的阵列的逐点乘法和逆FFT相同的转换。

The next steps would be do perform the same transform for a padded kernel, point-wise multiplication of the two complex arrays, and inverse FFT.