This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4 custom layer



Hello,

Env: PC simulation on Linux.

Recently I have built a custom layer and run smoothly in the beginning.

But after check the layer trace, I found some data lost in the dump output.

I have turned on the trace level 3 in import config file.

The custom layer output should have 256 x 576 size.

But the "0001_00003_00256x00192.y" file has only 256 x 570.

So I dump the output buffer by fwrite function and it has correct data which is 256 x 576.

I am curious about what cause this problem.

Thank you,

Kevin.

  • Hi Kevin,

    From the description it seems like an issue with ReshapeCustomLayer API.

    Can you review the dimValue calculation in this API.

    Regards,

    Rishabh

  • Thanks for reply,

    Where is the ReshapeCustomLayer located?

    Currently I set the dimValue by modifying TIDL_tfOutCustomIdentity function in tidl_import_common.cpp.

    I trace the process with gdb tools, founding it refers to the function above when doing caffe import.

    Kevin.

  • Hi Kevin,

    This API is there in <root_dir>\ti_dl\custom\tidl_custom_import.c.

    You need to have an entry corresponding to custom layer in respective import tool reshape table .

    In latest version of TIDL this table was moved to tidl_import_core.cpp (sTIDL_OutReshapeTable).

    { TIDL_CustomLayer                   ,  TIDL_tfOutReshapeCustomLayer }

    Regards,

    Rishabh

  • Hi,

    I have modified TIDL_tfOutReshapeCustomLayer function in tidl_custom_import.c.

    And I rebuild custom layer and import tools by the instruction below respectively:

    I use "make TARGET_BUILD = release PLATFORM=PC" in custom directory and "make" in util/tidlModelImport/ folder.

    In order to check if TIDL_tfOutReshapeCustomLayer has been called, I print some message in this function.

    After run instruction "./out/tidl_model_import.out   my_import_config" in tidlModelImport folder.

    The message didn't output and the trace dump layer has no difference.

    Again, it seems that customIdentity in tidl_import_common.cpp will be called and set the output dimValue.

    Also I checked run the execution file ./PC_dsp_test_dl_algo.out.

    The layer information shows as below:

    Num |TIDL Layer Name           |Group |#Ins |#Outs |Inbuf Ids          |Outbuf Id |In NCHW     |Out NCHW |

    2       |TIDL_ConvolutionLayer | 1         | 1    | 1       | 1 x x x x x x x | 2              |1 3 192 256 | 1 12 96 128 |

    But the Processing layer gives:

    Starting Layer # - 2
    Processing Layer # - 2

    Row Flow

    Stride; Fr; Fc; Ni; No; G;   bias; width; height; pad; inBlkSize; validColsIn; numMMAcalls;circBufPitch; coeffPitch; inChPitch; outChPitch;  totFetchAhead
           2;   3;   3;   3; 12; 1;        1;    256;     190; 1;        49345;        49859;                       1;          50240;            28;       49920;        12672;  514


    TIDL_ConvolutionLayer Ref
    Layer 2 , Output Matching : PASS
    End of Layer # - 2

    The problem occurs on all layers after layer 2.

    Thank you,

    Kevin.

  • Hi Kevin,

    What is the version of TIDL that you are using?

    Can you share the modified code of import tool (attach as a zip).

    Regards,

    Rishabh

  • Hi,

    It has a directory tidl_j7_01_01_00_10 under psdkra folder.

    Does the j7_01_01_00_10 represent version?

    8838.file.zip

    Here's the codes in tidlModelImport folder.

    Also have added my custom parameter in protoc and generate by protobuf.

    Thank you,

    Kevin.

  • Hi Kevin,

    Yes 01_01_00_10 represents the TIDL version.

    You have an entry for TIDL_tfOutCustomIdentity in sTIDL_caffeOutRehapeTable[] so this is the API that is used for reshaping the output tensor.

    Can you add breakpoints/prints and identify the values of x_max, x_min, y_max and y_min to see if you are getting the correct dimensions.

    Regarding convolution, kernel prints maxHeight- (Fr-1), so the value 190 is correct here.

    Regards,

    Rishabh

  • Hello,

    I've solved the dump issue, discovering that it is caused by the height padding size.

    So I calculated wrong size of channel pitch.

    Thank you for tracking on this problem.

    Kevin.