<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Dear Fiona, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143906#M26550</link>
    <description>&lt;P&gt;Dear Fiona,&lt;/P&gt;

&lt;P&gt;How can I&amp;nbsp;submit the case through private message?&lt;/P&gt;

&lt;P&gt;I'm very confused why it's different when I set the&amp;nbsp;environment variable&amp;nbsp;MKL_CBWR=AVX2 from&amp;nbsp;MKL_CBWR=AVX​​?&lt;/P&gt;

&lt;P&gt;I'll send you the resource data, could you help me to verify?&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Fiona Z. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;I am testing on win10, well, it is very hard to reproduce according to your&amp;nbsp;snippet. It would be great to provide a complete case and correct and wrong result you get from two system, you could submit case through private message or submit a ticket on &lt;A href="https://supporttickets.intel.com/servicecenter?lang=en-US"&gt;Intel Online Service Center &lt;/A&gt;. Please also attach the result you get and I would like to know how much it different. If it is a slightly different or totally different? Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jul 2017 10:00:34 GMT</pubDate>
    <dc:creator>Jessica</dc:creator>
    <dc:date>2017-07-18T10:00:34Z</dc:date>
    <item>
      <title>mkl convolution problems</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143896#M26540</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;when I used DNN-Operations of math kernel library on win7, visual studio2015, it worked well.&lt;/P&gt;

&lt;P&gt;convolution and maxpooling functions ​get same results, but faster.&lt;/P&gt;

&lt;P&gt;but, the convolution functions get different value changed on win10,&lt;/P&gt;

&lt;P&gt;do you have any ideas?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 03:29:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143896#M26540</guid>
      <dc:creator>Jessica</dc:creator>
      <dc:date>2017-07-10T03:29:25Z</dc:date>
    </item>
    <item>
      <title>Hi Jessica,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143897#M26541</link>
      <description>&lt;P style="font-size: 13.008px;"&gt;Hi Jessica,&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Could you please provide a sample case reproduced your problem. Thank you.&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 01:15:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143897#M26541</guid>
      <dc:creator>Zhen_Z_Intel</dc:creator>
      <dc:date>2017-07-11T01:15:54Z</dc:date>
    </item>
    <item>
      <title>Hi Fiona,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143898#M26542</link>
      <description>&lt;P&gt;Hi Fiona,&lt;/P&gt;

&lt;P&gt;Sure, thanks for reply.&lt;/P&gt;

&lt;P&gt;Here is the code snippets of convolution,&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;&amp;nbsp;&amp;nbsp;float *weights = layer.weights;
&amp;nbsp; float *input = state.input;
&amp;nbsp;///////////////////// mkl convolution ///////////////////////
&amp;nbsp;mkl_set_num_threads(4);
&amp;nbsp;size_t inp_size[] = { layer.h, layer.w, layer.c, 1 };
&amp;nbsp;size_t out_size[] = { out_h, out_w, m, 1 };
&amp;nbsp;size_t filt_size[] = { layer.size, layer.size, layer.c, m };
&amp;nbsp;size_t stride[] = { layer.stride, layer.stride };
&amp;nbsp;int pad[] = { -layer.pad, -layer.pad };

&amp;nbsp;dnnLayout_t conv_output = NULL;
&amp;nbsp;dnnPrimitive_t conv = NULL;
&amp;nbsp;dnnPrimitiveAttributes_t attributes = NULL;
&amp;nbsp;float *res_conv[dnnResourceNumber] = { 0 };
&amp;nbsp;dnnError_t err;

&amp;nbsp;CHECK_ERR(dnnPrimitiveAttributesCreate_F32(&amp;amp;attributes), err);

&amp;nbsp;CHECK_ERR(dnnConvolutionCreateForward_F32(&amp;amp;conv, attributes, dnnAlgorithmConvolutionDirect, 4,
&amp;nbsp;&amp;nbsp;inp_size, out_size, filt_size, stride, pad, dnnBorderZeros), err);

&amp;nbsp;res_conv[dnnResourceSrc] = input;
&amp;nbsp;res_conv[dnnResourceFilter] = weights;
&amp;nbsp;CHECK_ERR(dnnLayoutCreateFromPrimitive_F32(&amp;amp;conv_output, conv, dnnResourceDst), err);

&amp;nbsp;CHECK_ERR(dnnAllocateBuffer_F32((void**)&amp;amp;res_conv[dnnResourceDst], conv_output), err);

&amp;nbsp;// execution
&amp;nbsp;CHECK_ERR(dnnExecute_F32(conv, (void*)res_conv), err);&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;the input res_conv[dnnnResoureceSrc] and res_conv[dnnResourceFilter] are the same, but the&amp;nbsp; res_conv[dnnResourceDst] got different values on different machine.&lt;/P&gt;

&lt;P&gt;Do you have any idea?&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Jessica&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Fiona Z. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;Could you please provide a sample case reproduced your problem. Thank you.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 01:41:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143898#M26542</guid>
      <dc:creator>Jessica</dc:creator>
      <dc:date>2017-07-11T01:41:00Z</dc:date>
    </item>
    <item>
      <title>Hi Jessica,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143899#M26543</link>
      <description>&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;I feel confused with your code sample, seems you would like to read data from file and custom layout to calculate, however you only create layout for output but not for weight and input data. Even not do conversion process from your dnnLayout_t to&amp;nbsp;dnnPrimitive_t. Even not do dnnConversionExecute_F32 before execute. According to your code, you might always get result with 0. I fixed your sample as below and always get same result:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;mkl.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

struct ConvWeight {
    int M;
    int N;
    int K;
    float * weight; // M*N*K elements
    float * bias;   // K elements
};
#define CHECK_ERR(f) { auto err = f; if(err != E_SUCCESS) { std::cout &amp;lt;&amp;lt; "DNN Error " &amp;lt;&amp;lt; err &amp;lt;&amp;lt; " in line " &amp;lt;&amp;lt; __LINE__ &amp;lt;&amp;lt; std::endl; exit(-1); } }

void mkl_conv(ConvWeight layer, float * x, int xm, int xn, float * y, int ym, int yn)
{
	float *weights = layer.weight;
	//float *input = x;
	const int M = layer.M;
    const int N = layer.N;
    const int K = layer.K;
	 ///////////////////// mkl convolution ///////////////////////
	 mkl_set_num_threads(4);
	 /*size_t inp_size[] = { layer.h, layer.w, layer.c, 1 };
	 size_t out_size[] = { out_h, out_w, m, 1 };
	 size_t filt_size[] = { layer.size, layer.size, layer.c, m };
	 size_t stride[] = { layer.stride, layer.stride };
	 int pad[] = { -layer.pad, -layer.pad };*/
	 size_t inp_size[4] = { xm, 1, xn, 1 };
     size_t out_size[4] = { ym, 1, yn, 1 };
     size_t filt_size[4] = { M, 1, N, K };
     size_t stride[2] = { 1, 1 };
    int pad[2] = { 0, 0 };

	 dnnLayout_t conv_output = NULL;
	 dnnPrimitive_t conv = NULL;
	 dnnPrimitiveAttributes_t attributes = NULL;
	 float *res_conv[dnnResourceNumber] = { 0 };

	 CHECK_ERR(dnnPrimitiveAttributesCreate_F32(&amp;amp;attributes));

	 CHECK_ERR(dnnConvolutionCreateForward_F32(&amp;amp;conv, attributes, dnnAlgorithmConvolutionDirect, 4,
	  inp_size, out_size, filt_size, stride, pad, dnnBorderZeros));

	 res_conv[dnnResourceSrc] = x;
	 res_conv[dnnResourceFilter] = weights;
	 res_conv[dnnResourceDst] = y;
	// CHECK_ERR(dnnLayoutCreateFromPrimitive_F32(&amp;amp;conv_output, conv, dnnResourceDst));

	 //CHECK_ERR(dnnAllocateBuffer_F32((void**)&amp;amp;res_conv[dnnResourceDst], conv_output));

	 // execution
	 CHECK_ERR(dnnExecute_F32(conv, (void **)res_conv));

	 CHECK_ERR(dnnDelete_F32(conv));
    CHECK_ERR(dnnPrimitiveAttributesDestroy_F32(attributes));
}

int main(int argc, char* argv[])
{
    const int X = 33; 
    const int M = 13; 
    const int N = 15; 
    const int K = 17;

    const int Y = X - M + 1; 

    ConvWeight cw;
    cw.M = M;
    cw.N = N;
    cw.K = K;
    cw.bias = (float*)mkl_malloc(K*sizeof(float), 128);
    cw.weight = (float*)mkl_malloc(M*N*K*sizeof(float), 128);

    // Input is [X,1,N]
    float * input = (float*)mkl_malloc(X*N*sizeof(float), 128);

    // Output is [Y,1,K]
    float * output1 = (float*)mkl_malloc(Y*K*sizeof(float), 128);
    float * output2 = (float*)mkl_malloc(Y*K*sizeof(float), 128);

    for (int i = 0; i &amp;lt; K; i++)
        cw.bias&lt;I&gt; = float(i + 1) / float(K);

    for (int i = 0; i &amp;lt; M*N*K; i++)
        cw.weight&lt;I&gt; = float(i + 1) / float(M*N*K);

    for (int i = 0; i &amp;lt; X*N; i++)
        input&lt;I&gt; = float(i + 1) / float(X*N);


    mkl_conv(cw, input, X, N, output2, Y, K);
   
    FILE* f = fopen("mkl_dnn.txt", "w");
    if (f != NULL)
    {
        fprintf(f, "Results:\n");
        for(int i=0;i&amp;lt;Y;i++)
        {
            for(int j=0;j&amp;lt;K;j++)
            {
                fprintf(f,"%f\t",output2[i*K+j]);
            }
            fprintf(f,"\n");
        }
        fclose(f);
    }

    

	return 0;
}
&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;Or you could follow our example code for dnn convlution. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 03:21:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143899#M26543</guid>
      <dc:creator>Zhen_Z_Intel</dc:creator>
      <dc:date>2017-07-11T03:21:44Z</dc:date>
    </item>
    <item>
      <title>Hi Fiona,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143900#M26544</link>
      <description>&lt;P&gt;Hi Fiona,&lt;/P&gt;

&lt;P&gt;Thanks again.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I know what you mean, the code I given just a snippet, the input and weights of convolution are read from a file, floating point pointer.&lt;/P&gt;

&lt;P&gt;It's strange for me, when compute on win7, VS2015, the results are correct, but the same code get different result after execute on win10, not 0, other floating number.&lt;/P&gt;

&lt;P&gt;I was confused couple of days.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Jessica&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Fiona Z. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;I feel confused with your code sample, seems you would like to read data from file and custom layout to calculate, however you only create layout for output but not for weight and input data. Even not do conversion process from your dnnLayout_t to&amp;nbsp;dnnPrimitive_t. Even not do dnnConversionExecute_F32 before execute. According to your code, you might always get result with 0. I fixed your sample as below and always get same result:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;mkl.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

struct ConvWeight {
    int M;
    int N;
    int K;
    float * weight; // M*N*K elements
    float * bias;   // K elements
};
#define CHECK_ERR(f) { auto err = f; if(err != E_SUCCESS) { std::cout &amp;lt;&amp;lt; "DNN Error " &amp;lt;&amp;lt; err &amp;lt;&amp;lt; " in line " &amp;lt;&amp;lt; __LINE__ &amp;lt;&amp;lt; std::endl; exit(-1); } }

void mkl_conv(ConvWeight layer, float * x, int xm, int xn, float * y, int ym, int yn)
{
	float *weights = layer.weight;
	//float *input = x;
	const int M = layer.M;
    const int N = layer.N;
    const int K = layer.K;
	 ///////////////////// mkl convolution ///////////////////////
	 mkl_set_num_threads(4);
	 /*size_t inp_size[] = { layer.h, layer.w, layer.c, 1 };
	 size_t out_size[] = { out_h, out_w, m, 1 };
	 size_t filt_size[] = { layer.size, layer.size, layer.c, m };
	 size_t stride[] = { layer.stride, layer.stride };
	 int pad[] = { -layer.pad, -layer.pad };*/
	 size_t inp_size[4] = { xm, 1, xn, 1 };
     size_t out_size[4] = { ym, 1, yn, 1 };
     size_t filt_size[4] = { M, 1, N, K };
     size_t stride[2] = { 1, 1 };
    int pad[2] = { 0, 0 };

	 dnnLayout_t conv_output = NULL;
	 dnnPrimitive_t conv = NULL;
	 dnnPrimitiveAttributes_t attributes = NULL;
	 float *res_conv[dnnResourceNumber] = { 0 };

	 CHECK_ERR(dnnPrimitiveAttributesCreate_F32(&amp;amp;attributes));

	 CHECK_ERR(dnnConvolutionCreateForward_F32(&amp;amp;conv, attributes, dnnAlgorithmConvolutionDirect, 4,
	  inp_size, out_size, filt_size, stride, pad, dnnBorderZeros));

	 res_conv[dnnResourceSrc] = x;
	 res_conv[dnnResourceFilter] = weights;
	 res_conv[dnnResourceDst] = y;
	// CHECK_ERR(dnnLayoutCreateFromPrimitive_F32(&amp;amp;conv_output, conv, dnnResourceDst));

	 //CHECK_ERR(dnnAllocateBuffer_F32((void**)&amp;amp;res_conv[dnnResourceDst], conv_output));

	 // execution
	 CHECK_ERR(dnnExecute_F32(conv, (void **)res_conv));

	 CHECK_ERR(dnnDelete_F32(conv));
    CHECK_ERR(dnnPrimitiveAttributesDestroy_F32(attributes));
}

int main(int argc, char* argv[])
{
    const int X = 33; 
    const int M = 13; 
    const int N = 15; 
    const int K = 17;

    const int Y = X - M + 1; 

    ConvWeight cw;
    cw.M = M;
    cw.N = N;
    cw.K = K;
    cw.bias = (float*)mkl_malloc(K*sizeof(float), 128);
    cw.weight = (float*)mkl_malloc(M*N*K*sizeof(float), 128);

    // Input is [X,1,N]
    float * input = (float*)mkl_malloc(X*N*sizeof(float), 128);

    // Output is [Y,1,K]
    float * output1 = (float*)mkl_malloc(Y*K*sizeof(float), 128);
    float * output2 = (float*)mkl_malloc(Y*K*sizeof(float), 128);

    for (int i = 0; i &amp;lt; K; i++)
        cw.bias&lt;I&gt; = float(i + 1) / float(K);

    for (int i = 0; i &amp;lt; M*N*K; i++)
        cw.weight&lt;I&gt; = float(i + 1) / float(M*N*K);

    for (int i = 0; i &amp;lt; X*N; i++)
        input&lt;I&gt; = float(i + 1) / float(X*N);


    mkl_conv(cw, input, X, N, output2, Y, K);
   
    FILE* f = fopen("mkl_dnn.txt", "w");
    if (f != NULL)
    {
        fprintf(f, "Results:\n");
        for(int i=0;i&amp;lt;Y;i++)
        {
            for(int j=0;j&amp;lt;K;j++)
            {
                fprintf(f,"%f\t",output2[i*K+j]);
            }
            fprintf(f,"\n");
        }
        fclose(f);
    }

    

	return 0;
}
&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;Or you could follow our example code for dnn convlution. Thanks.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 05:48:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143900#M26544</guid>
      <dc:creator>Jessica</dc:creator>
      <dc:date>2017-07-11T05:48:22Z</dc:date>
    </item>
    <item>
      <title>Hi Jessica,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143901#M26545</link>
      <description>&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;I am testing on win10, well, it is very hard to reproduce according to your&amp;nbsp;&lt;SPAN style="font-size: 12px;"&gt;snippet. It would be great to provide a complete case and correct and wrong result you get from two system, you could submit case through private message or submit a ticket on &lt;A href="https://supporttickets.intel.com/servicecenter?lang=en-US"&gt;Intel Online Service Center &lt;/A&gt;. Please also attach the result you get and I would like to know how much it different. If it is a slightly different or totally different? Thanks.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 05:59:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143901#M26545</guid>
      <dc:creator>Zhen_Z_Intel</dc:creator>
      <dc:date>2017-07-11T05:59:44Z</dc:date>
    </item>
    <item>
      <title>Hi Fiona,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143902#M26546</link>
      <description>&lt;P&gt;Hi Fiona,&lt;/P&gt;

&lt;P&gt;Thanks a lot,&lt;/P&gt;

&lt;P&gt;It's hard to say, you konw, I also took a simple test on two system, obviously correct, and the simple sample as below:&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;mkl.h&amp;gt;

int main() 
{
&amp;nbsp;float data[] = {
&amp;nbsp;&amp;nbsp;1,1,1,1,1,
&amp;nbsp;&amp;nbsp;3,3,3,3,3,
&amp;nbsp;&amp;nbsp;2,2,2,2,2,
&amp;nbsp;&amp;nbsp;4,4,4,4,4,
&amp;nbsp;&amp;nbsp;3,3,3,3,3,
&amp;nbsp;&amp;nbsp;1,1,1,1,1,
&amp;nbsp;&amp;nbsp;2,2,2,2,2,
&amp;nbsp;&amp;nbsp;3,3,3,3,3,
&amp;nbsp;&amp;nbsp;4,4,4,4,4,
&amp;nbsp;&amp;nbsp;5,5,5,5,5 };
&amp;nbsp;float k[] = {
&amp;nbsp;&amp;nbsp;1, 1, 1,
&amp;nbsp;&amp;nbsp;1, 0, 0,
&amp;nbsp;&amp;nbsp;1, 1, 1,
&amp;nbsp;&amp;nbsp;1, 1, 1,
&amp;nbsp;&amp;nbsp;1, 1, 1,
&amp;nbsp;&amp;nbsp;1, 0, 0,
&amp;nbsp;&amp;nbsp;1, 1, 1,
&amp;nbsp;&amp;nbsp;1, 0, 0,
&amp;nbsp;&amp;nbsp;1, 1, 1,
&amp;nbsp;&amp;nbsp;1, 0, 0,
&amp;nbsp;&amp;nbsp;1, 1, 1,
&amp;nbsp;&amp;nbsp;1, 1, 1 };

&amp;nbsp;float *out = mkl_calloc(8, sizeof(float), 0);

&amp;nbsp;dnnError_t err;

&amp;nbsp;// output size: out_w, out_h, channel, batch_size
&amp;nbsp;size_t out_size[] = { 2, 2, 2, 1 };
&amp;nbsp;// input size: 
&amp;nbsp;size_t inp_size[] = { 5, 5, 2, 1 };
&amp;nbsp;size_t filt_size[] = { 3, 3, 2, 2 };
&amp;nbsp;size_t conv_stride[2] = { 2, 2 };
&amp;nbsp;// pad
&amp;nbsp;int inp_offset[2] = { 0, 0 };

&amp;nbsp;dnnPrimitive_t conv = NULL;
&amp;nbsp;float* res_conv[dnnResourceNumber] = { 0 };
&amp;nbsp;
&amp;nbsp;dnnPrimitiveAttributes_t attributes = NULL;

&amp;nbsp;dnnPrimitiveAttributesCreate_F32(&amp;amp;attributes);
&amp;nbsp;
&amp;nbsp;dnnConvolutionCreateForward_F32(&amp;amp;conv, attributes, dnnAlgorithmConvolutionDirect, 4,
&amp;nbsp;&amp;nbsp;inp_size, out_size, filt_size, conv_stride, inp_offset, dnnBorderZeros);

&amp;nbsp;res_conv[dnnResourceSrc] = data;
&amp;nbsp;res_conv[dnnResourceFilter] = k;
&amp;nbsp;res_conv[dnnResourceDst] = out;

&amp;nbsp;dnnExecute_F32(conv, (void*)res_conv);

&amp;nbsp;dnnDelete_F32(conv);
&amp;nbsp;dnnPrimitiveAttributesDestroy_F32(attributes);

&amp;nbsp;for (int i = 0; i &amp;lt; 8; ++i) {
&amp;nbsp;&amp;nbsp;printf("%f ", out&lt;I&gt;);
&amp;nbsp;}

&amp;nbsp;mkl_free(out);
&amp;nbsp;getchar();
&amp;nbsp;return 0;
}&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;But on my own project, it tooks wrong,&lt;/P&gt;

&lt;P&gt;I will print parts of reults of input of convolution&amp;nbsp; before execute and output after execute,&lt;/P&gt;

&lt;P&gt;win7:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="yolo-mkl-win7-conv1.PNG"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/9593i1A186B35D72C5337/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="yolo-mkl-win7-conv1.PNG" alt="yolo-mkl-win7-conv1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;win10:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="yolo-mkl-win10-conv1.PNG"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/9594i92F5573D6214709D/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="yolo-mkl-win10-conv1.PNG" alt="yolo-mkl-win10-conv1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;you can see, the inputs are the same, but output are totally different.&lt;/P&gt;

&lt;P&gt;I really don't konw how can I do..Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Jessica&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Fiona Z. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;I am testing on win10, well, it is very hard to reproduce according to your&amp;nbsp;snippet. It would be great to provide a complete case and correct and wrong result you get from two system, you could submit case through private message or submit a ticket on &lt;A href="https://supporttickets.intel.com/servicecenter?lang=en-US"&gt;Intel Online Service Center &lt;/A&gt;. Please also attach the result you get and I would like to know how much it different. If it is a slightly different or totally different? Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 08:24:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143902#M26546</guid>
      <dc:creator>Jessica</dc:creator>
      <dc:date>2017-07-11T08:24:49Z</dc:date>
    </item>
    <item>
      <title>Hi Jessica,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143903#M26547</link>
      <description>&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;Would it possible to share your complete project (send author a message)? You could send via private message that only Intel staff can see it. I could not reproduce through simple single step calculation that I personally believe it may not be problem of conv interface for MKL 2017u3. Would you please provide more info about the version of MKL? For MKL2017u3, the send argument of execution function &lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 13.008px; background-color: rgb(248, 248, 248);"&gt;dnnExecute_F32&lt;/SPAN&gt;&amp;nbsp;probably should be as the input of void ** type. &lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 13.008px; background-color: rgb(248, 248, 248);"&gt;dnnExecute_F32(&lt;/SPAN&gt;&lt;CODE class="plain" style="font-size: 13.008px; background-color: rgb(248, 248, 248); color: rgb(0, 0, 0); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; min-height: auto !important;"&gt;conv, (&lt;/CODE&gt;&lt;CODE class="keyword bold" style="font-size: 13.008px; background-color: rgb(248, 248, 248); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-weight: bold !important; min-height: auto !important; color: rgb(0, 102, 153) !important;"&gt;void&lt;/CODE&gt;&lt;CODE class="plain" style="font-size: 13.008px; background-color: rgb(248, 248, 248); color: rgb(0, 0, 0); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace !important; margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; min-height: auto !important;"&gt;**)res_conv&lt;/CODE&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 13.008px; background-color: rgb(248, 248, 248);"&gt;)&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 08:56:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143903#M26547</guid>
      <dc:creator>Zhen_Z_Intel</dc:creator>
      <dc:date>2017-07-11T08:56:26Z</dc:date>
    </item>
    <item>
      <title>Hi Fiona,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143904#M26548</link>
      <description>&lt;P&gt;Hi Fiona,&lt;/P&gt;

&lt;P&gt;Thanks and sorry for this, it's seems the avx2 problem, the older machine didn't support avx2, so it worked,&lt;/P&gt;

&lt;P&gt;I also test on some other machine, it seems to be true.&lt;/P&gt;

&lt;P&gt;How could I solve this problem?Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Jessica&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Fiona Z. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;Would it possible to share your complete project (send author a message)? You could send via private message that only Intel staff can see it. I could not reproduce through simple single step calculation that I personally believe it may not be problem of conv interface for MKL 2017u3. Would you please provide more info about the version of MKL? For MKL2017u3, the send argument of execution function dnnExecute_F32&amp;nbsp;probably should be as the input of void ** type. dnnExecute_F32(conv, (void**)res_conv)&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 10:25:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143904#M26548</guid>
      <dc:creator>Jessica</dc:creator>
      <dc:date>2017-07-11T10:25:33Z</dc:date>
    </item>
    <item>
      <title>Hi Fiona,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143905#M26549</link>
      <description>&lt;P&gt;Hi Fiona,&lt;/P&gt;

&lt;P&gt;Now, I'm sure that is the avx2 problem, when I set the&amp;nbsp;environment variable&amp;nbsp;&lt;FONT face="Consolas"&gt;MKL_CBWR=&lt;SPAN style="background-color:#FFFF00;color:#222222;"&gt;AVX, the result get&amp;nbsp;correct.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Consolas"&gt;&lt;SPAN style="background-color:#FFFF00;color:#222222;"&gt;​Thanks for your time, it means a lot to me.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Consolas"&gt;&lt;SPAN style="background-color:#FFFF00;color:#222222;"&gt;Best Regards,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Consolas"&gt;&lt;SPAN style="background-color:#FFFF00;color:#222222;"&gt;​Jessica&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Fiona Z. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;Would it possible to share your complete project (send author a message)? You could send via private message that only Intel staff can see it. I could not reproduce through simple single step calculation that I personally believe it may not be problem of conv interface for MKL 2017u3. Would you please provide more info about the version of MKL? For MKL2017u3, the send argument of execution function dnnExecute_F32&amp;nbsp;probably should be as the input of void ** type. dnnExecute_F32(conv, (void**)res_conv)&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 10:48:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143905#M26549</guid>
      <dc:creator>Jessica</dc:creator>
      <dc:date>2017-07-11T10:48:28Z</dc:date>
    </item>
    <item>
      <title>Dear Fiona,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143906#M26550</link>
      <description>&lt;P&gt;Dear Fiona,&lt;/P&gt;

&lt;P&gt;How can I&amp;nbsp;submit the case through private message?&lt;/P&gt;

&lt;P&gt;I'm very confused why it's different when I set the&amp;nbsp;environment variable&amp;nbsp;MKL_CBWR=AVX2 from&amp;nbsp;MKL_CBWR=AVX​​?&lt;/P&gt;

&lt;P&gt;I'll send you the resource data, could you help me to verify?&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Fiona Z. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;I am testing on win10, well, it is very hard to reproduce according to your&amp;nbsp;snippet. It would be great to provide a complete case and correct and wrong result you get from two system, you could submit case through private message or submit a ticket on &lt;A href="https://supporttickets.intel.com/servicecenter?lang=en-US"&gt;Intel Online Service Center &lt;/A&gt;. Please also attach the result you get and I would like to know how much it different. If it is a slightly different or totally different? Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 10:00:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143906#M26550</guid>
      <dc:creator>Jessica</dc:creator>
      <dc:date>2017-07-18T10:00:34Z</dc:date>
    </item>
    <item>
      <title>Hi Jessica,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143907#M26551</link>
      <description>&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;You could send private message by "Send Author A Message". And the private message only can be seen by yourself and Intel internal member. Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 03:46:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143907#M26551</guid>
      <dc:creator>Zhen_Z_Intel</dc:creator>
      <dc:date>2017-07-21T03:46:22Z</dc:date>
    </item>
    <item>
      <title>Hi Fiona,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143908#M26552</link>
      <description>&lt;P&gt;Hi Fiona,&lt;/P&gt;

&lt;P&gt;Thanks for reply, I just can't find that way.&lt;/P&gt;

&lt;P&gt;I have already upload the project on this topic, &lt;A href="https://software.intel.com/en-us/node/738438" target="_blank"&gt;https://software.intel.com/en-us/node/738438&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Could you please help to verify?&lt;/P&gt;

&lt;P&gt;And I also found it could be run on x86 platform, but not for x64.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Jessica&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Fiona Z. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;You could send private message by "Send Author A Message". And the private message only can be seen by yourself and Intel internal member. Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 04:27:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143908#M26552</guid>
      <dc:creator>Jessica</dc:creator>
      <dc:date>2017-07-21T04:27:48Z</dc:date>
    </item>
    <item>
      <title>Hi jessica,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143909#M26553</link>
      <description>&lt;P&gt;Hi jessica,&lt;/P&gt;

&lt;P&gt;Thanks. We are investigating on it. I will give you reply soon.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 06:54:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143909#M26553</guid>
      <dc:creator>Zhen_Z_Intel</dc:creator>
      <dc:date>2017-07-31T06:54:49Z</dc:date>
    </item>
    <item>
      <title>Hi Jessica,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143910#M26554</link>
      <description>&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;We found the root cause, it looks like convolution primitive is not being correctly used. This particular example assumes that convolution takes data in NCHW format and produces NCHW output, while in reality it can use &lt;A href="https://software.intel.com/en-us/mkl-developer-reference-c-deep-neural-network-functions"&gt;different format&lt;/A&gt;s depending on problem shape and architecture. So in general you always need to query primitive for required layout, convert your input to the required layout and then convert the output back to your original layout. I modified your program, please have a check with attached file, and the result of AVX &amp;amp; AVX2 implementation are the same. Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 03:22:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143910#M26554</guid>
      <dc:creator>Zhen_Z_Intel</dc:creator>
      <dc:date>2017-08-01T03:22:14Z</dc:date>
    </item>
    <item>
      <title>Hi Fiona,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143911#M26555</link>
      <description>&lt;P&gt;Hi Fiona,&lt;/P&gt;

&lt;P&gt;Thanks for your reply!!!&lt;/P&gt;

&lt;P&gt;It's worked for me!&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Jessica&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Fiona Z. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi Jessica,&lt;/P&gt;

&lt;P&gt;We found the root cause, it looks like convolution primitive is not being correctly used. This particular example assumes that convolution takes data in NCHW format and produces NCHW output, while in reality it can use &lt;A href="https://software.intel.com/en-us/mkl-developer-reference-c-deep-neural-network-functions"&gt;different format&lt;/A&gt;s depending on problem shape and architecture. So in general you always need to query primitive for required layout, convert your input to the required layout and then convert the output back to your original layout. I modified your program, please have a check with attached file, and the result of AVX &amp;amp; AVX2 implementation are the same. Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 01:32:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-convolution-problems/m-p/1143911#M26555</guid>
      <dc:creator>Jessica</dc:creator>
      <dc:date>2017-08-04T01:32:03Z</dc:date>
    </item>
  </channel>
</rss>

