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 data padding question

Other Parts Discussed in Thread: TDA2

Hi,

I'm confused about the data padding.

In the previous TDA2 version TIDL has all 4 padding in all directions and it's easy to understand.

According to the documents "ti_dl/docs/user_guide_html/md_tidl_fsg_io_tensors_format.html" , it indicates that input and output will have pad{T , L ,R ,B}.

But when I' m checking some value in custom layer example, it uses padH and padW.

Here's the first question:

Is padH  = pad Top , pad Bot?

Is padW = pad Left , pad Right?

Also I check the value of some variables in the custom layer I made, founding that variables have different value when running quantools(TIDL Process with REF_ONLY FLOW) and inference phase.

For example :

In the quantools phase:

    A inData has width and height with 128 ,96 respectively , and its padW and padH equal to 1.

    InData pitch equal to 12771 (Channel Pitch)  and  129(Line Pitch). (12771 = 129 x 99).

    Why the Channel Pitch is 129 x 99?

In inference phase :

    InData has {w , h , padW , padH } = {128, 96 ,0 ,0 }.

    InData pitch equal to 12416 (Channel Pitch)  and  128(Line Pitch). (12416 = 128 x 97).

    Why the Channel Pitch is 128 x 97 not 128 x 96?

There is a same question about outData.

The outData dims should be 64x48.

outData channel pitch is 3840 and line pitch is 72.

3840 isn't divisible by 72.

Could you please explain how the padding method works in TIDL or some customer layer import setting I probably miss to cause this problem.

Thank you,

Kevin

  • Hi Kevin,

        Is padH  = pad Top , pad Bot? 

    Anshu >>> Yes. We assume symmetric padding in both direction so same padding is used for top and bottom of feature map.

        Is padW = pad Left , pad Right?

    Anshu >>> This padding is only in one direction ( pad left) as during computation the same padding value (of next line) is used for the right side also.    This requires one extra pixel towards the end of feature map and for allocation of input/output buffers to the network we consider full line for the same. So size of a feature map is (( W + PW ) * ( H + 2PH ) )+ PW. Where W and H are width and height of the feature map, PW = padW and PH = padH.

    Regards,

    Anshu

  •  Thanks for your reply.

    Could you please elaborate in detail with some illustrations or examples?

    The padW part is a little sophisticated.

    In my case :

    tidlLayer->outData[0].padH , padW ==  2 , 8.

    Output width and height are 64 and 48.

    outData channel pitch is 3840 and line pitch is 72.

    I got these pitch value from outDataParams->pitch[1] and outDataParams->pitch[2] respectively.

    Somehow the channel pitch is not divisible by Line pitch.

    I wonder if I have missed for some parameters setting in the import phase.

    Thank you,

    Kevin.

  • Hi Kevin,

       Channel pitch need not be a multiple of line pitch. The reason is that sometimes we align channel pitch in such a way that it is more efficient from DMA/kernel access point of view. But the minimum channel pitch should be as mentioned in my previous response (( W + PW ) * ( H + 2PH ))  + PW ( I just noticed that one of the bracket was in correct in my previous response, I have corrected it now).

    Regards,

    Anshu