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.

J721EXCPXEVM: Integer underflow in reference implementation of sigmoid layer

Part Number: J721EXCPXEVM


Hello,

I work with the same model topology but with different weights and sometimes I run into a case when imported model has a huge accuracy drop.

Layer by layer comparison of such cases brought me to conclusion that such behavior is caused by malfunction of sigmoid layer since its min/max

ranges in affected models exceed expected one.

Here is a range for one affected model reported by tidl_model_import tool:

75 4.92151 0.00000 50.34475 0

Such range is a cause of significant differences between float and fixed versions of an imported model as shown in following diagram:

Further analysis has shown that integer underflow in reference sigmoid implementation causes the issue.

The underflow error occurs for certain negative input values and input scales.

The integer underflow takes place in TIDL_refSigmoidCore method at 396 line:

outVal = offset[0]*offsetScale - outVal;

where outVal = 1434, offset[0] = 130 and offsetScale = 11

 

and outVal is evaluated as following

outVal = slope[1] * inDataValAbs + offset[1]*offsetScale;

where slope[1] = 4, inDataValAbs = 56, and offset[1] = 110

 

I may suppose that treshold0 is set too high (inputScale = 11.250186) and it leads to wrong outVal calculation.

 

Introducing additional check for underflow before subtraction fixes the issue with wrong range while importing but

has minimal effect on device evaluation where I got following results:

 We can see on diagram above that some kind of underflow error is still present and only magnitude of max values have

changed. 

All tests were performed with rtos-j721e-evm-07_02_00_06 and tidl_j7_01_04_00_08.

I hope that this information will help to fix the issue.

Thanks.

  • Hi,

    Sorry for the late reply.

    We fixed this kind issues in the sigmoid layer and those fixes will be available in the upcoming release (rtos-j721e-evm-07_03_00_0x, which is planned in the early next week).

    Please test with the latest release and if you still face some issues, let us know.

    Thanks,

    Praveen

  • Hi,

    This release is out and can be downloaded from this link : www.ti.com/.../07.03.00.07

    Please test with this release.

    Thanks,

    Praveen

  • Hello,
    Thank for your reply. I've tested last RTOS release - ti-processor-sdk-rtos-j721e-evm-07_03_00_07-prebuilt.
    It looks like the issue is fixed only for PC platform and it is still reproducible on a device.
    A plot with comparison results between 32-bit and 8-bit evaluated on a device is the same as last one
    in my original report with MaxAbsDiff 0.8083.
    I also noticed that the issue depends on quantizationStyle import parameter (I use linear mode) and
    a result model isn't affected to the issue when quantizationStyle is set to 3 (Power of 2 scales).

  • Hi,

    Hope you had reimported the model with latest release and still facing the issue on the device.

    Kindly share the model and import and infer config files to replicate the issue at our end ?

    Thanks,

    Praveen