Maratyszcza/NNPACK

nnp_softmax_output bug

klyukinds opened this issue · 0 comments

Good day, everyone!
Recently, i've noticed that nnp_softmax_output result is buggy(imho) for some inputs.
Examples:
First one :
std::vector<float> input {9.34623, 8.43469, 7.19462, 6.59385, 5.89481, 5.67304}; std::vector<float> output(6); nnp_softmax_output(1, 6, input.data(), output.data(), nullptr);
example's output will be :
0.571349, 0.285674, 0.0714186, 0.0357093, 0.0178546, 0.0178546
And it sum's to : 0.99986 which is not equal to 1 !
Ground truth values for this input:
0.61010081, 0.24520245, 0.07095275, 0.03890972, 0.01934056, 0.01549371

Second:
This time i take a part of previous input, for example first three numbers:
std::vector<float> input {9.34623, 8.43469, 7.19462}; std::vector<float> output(3); nnp_softmax_output(1, 3, input.data(), output.data(), nullptr);
The output will be :
0.658674, 0.264724, 0.0766017
And the sum is exactly 1

Please help me to find a reason, why i have such behaviour, which have strong relation to the size of the input ?

I use libnnpack compiled for x86 processror with avx2.
Thank you in advance!