google / XNNPACK

High-efficiency floating-point neural network inference operators for mobile, server, and Web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect transpose results

KnightJun opened this issue · comments

This is a tensor with shape [2, 2, 1, 1], use transpose by perm [0, 2, 3, 1], it shoul not change the data. But from the results of my tests, by the partial loss of data.

Here is my test cases.

    // windows /  msvc  /  the code clone on May 5th.
    float inData[4] = {1,2,3,4};
    float outData[4] = {0};
    size_t perm[4] = {0, 2, 3, 1};
    size_t in_shape[4] = {2, 2, 1, 1};
    int inDim = 4;
    auto status = xnn_create_transpose_nd_x32(0, &transpose_opt);
    xnn_setup_transpose_nd_x32(transpose_opt, inData, outData, 
        inDim, in_shape, perm, mThreadPool);
    xnn_run_operator(transpose_opt, mThreadPool);
    printf("outData:%f, %f, %f, %f\n", outData[0], outData[1], outData[2], outData[3]);
   // outData:1.000000, 2.000000, 0.000000, 0.000000

outData should be {1, 2, 3, 4}, by actually outputs {1, 2, 0, 0}.

Hi thanks for reporting this and for the super simple test cast, it really makes life easier.

This was patched yesterday: f42a24e

Please pull the latest code and it should work!