ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

SoftMax Layer giving incorrect results

Open BhaskarsarmaP opened this issue 8 years ago • 7 comments

softmax layer is giving incorrect results for my given inputs. The wrapper file which i used is attached and the input binary file provided is also attached. When i compared with the cudnn softmax layer output for the same input,There is mismatch between the results. The Expected Results(outputs of softmax layer - cudnn) are also attached.

used Latest ARM Compute Library ARM_NEON (ARM Cortex v7) Tested on Raspberry Pi3 -- Arch Linux

Makefile -> makesftm.txt cpp source file->sftm.txt input.txt softmax_obtainedOutput.txt softmax_DesiredOutput.txt

BhaskarsarmaP avatar Mar 30 '18 12:03 BhaskarsarmaP

Hello @BhaskarsarmaP,

Can you provide us on how you calculate the reference as well?

GeorgeARM avatar Apr 03 '18 10:04 GeorgeARM

Hi @BhaskarsarmaP

I've been looking at your code and I found an issue, the function fillIpToTensor() doesn't seem to work properly and the values in the input tensor are not properly filled.

You can see this if you just add the following code just after the call to fill the input tensor

src.print(std::cout,IOFormatInfo::PrintRegion::Full);

The way the code loads the values from the 'input.bin' file doesn't seem to work, the attached input.txt file is not binary so the code pFile = fopen("input.txt","rb"); is not the good way to open the input file.

I modified the code to parse the input.txt file properly but the output tensor still contains smaller numbers from what you expect 'softmax_DesiredOutput.txt'.

Could you please provide the information requested by @GeorgeARM?

morgolock avatar Apr 05 '18 10:04 morgolock

Hi @BhaskarsarmaP

Another question: In your example there are 3 Channels, when you load the input values from the file what data layout do you assume? NCHW or NHWC? What's the layout of the input.txt file attached above?

morgolock avatar Apr 05 '18 12:04 morgolock

Hi @morgolock I was unable to attach the binary file.so i attached the test file to you. The desired output test file is obtained when i tested the softmax layer with cudnn

BhaskarsarmaP avatar Apr 05 '18 13:04 BhaskarsarmaP

Hi @BhaskarsarmaP

Could you please share the cudnn code you use to generate the values in 'softmax_DesiredOutput.txt' ?

morgolock avatar Apr 05 '18 13:04 morgolock

Hi @BhaskarsarmaP

I was looking at the values in 'softmax_DesiredOutput.txt' and something seems wrong, the sum of all these values is supposed to be close to 1 and currently is ~ 1023.999625

The values you use as reference seem to be scaled up by 1000.

morgolock avatar Apr 05 '18 14:04 morgolock

No problem with the Compute Library as far as we can tell, and not enough user information.

Closing for now (Re-open if you've got more information to provide)

AnthonyBarbier avatar Apr 23 '18 14:04 AnthonyBarbier