KhronosGroup / NNEF-Tools

The NNEF Tools repository contains tools to generate and consume NNEF documents
https://www.khronos.org/nnef
222 stars 58 forks source link

NNEF test cases output result unmatching #121

Closed Jiaqing-Cao closed 4 years ago

Jiaqing-Cao commented 4 years ago

Hi Viktor, I used NNEF-Tools parser cpp code "infer.cpp' linking nnef lib, compile with : g++ -std=c++11 -I include infer.cpp -Lbuild -l:libnnef.a -o infer It can compile successfully, however, when I test some test cases from the operation/core folder, for example kernel "conv3x3" the output.dat we get using the input.dat is different from the "operation/core/conv3x3/output.dat". ./infer ~/core/conv3x3 --input ~/core/conv3x3/input.dat --output ~/core/conv3x3/output.dat --compare We will get : Executing model : /home/falcon/core/conv3x3: 'output' diff = 2.02449e-07

In the operation/core folder, there are 72 test cases total, of those 72 cases, 43 have that kind of error.

And one kernel named argmax_reduce_channel will crash at infer: /home/falcon/NNEF-Tools/parser/cpp/src/nnef.cpp:234: bool nnef::read_tensor(std::istream&, nnef::Tensor&, std::string&): Assertion `header.quant_params[0] == 1' failed.

NNEF-test -cases.xlsx

gyenesvi commented 4 years ago

Hi, the difference in the output is not a problem or bug, it does no have to be 0, on the order of 10e-4 or 10e-5 is already perfectly fine. This is because the reference outputs were not generated with this implementation, and the order of floating point operations effects the results, which is different across implementations, so we don't expect exactly the same results, only quite close to it.

The assertion failure is the result of a recently introduced fix in the reader, which was intended to solve some spec problems in the binary file format, but it is not perfect yet. In fact, this modification of the spec is already in the pipeline, so hopefully we'll have some changes there soon. For now, it is enough to remove that assertion I think.

Jiaqing-Cao commented 4 years ago

Okay, I see, thank you very much for the reply.