xboot / libonnx

A lightweight, portable pure C99 onnx inference engine for embedded devices with hardware acceleration support.
MIT License
586 stars 108 forks source link

isnan and isinf issue #2

Closed noomio closed 4 years ago

noomio commented 4 years ago

Hi,

When I compile I get the following error with clang. I then try to link the library and it complains. Not quite sure why, I added in the main.c isnan and isinf and compiles ok. -lm is added to the linker.

Library compilation: default/IsNaN.c:34:11: warning: implicit declaration of function 'isnanf' is invalid in C99 [-Wimplicit-function-declaration] py[i] = isnanf(v) ? 1 : 0;

Linker: libonnx.a(.text+0x598): undefined reference to isnanf'

noomio commented 4 years ago

Oh its a float check. Didn't see it. I added this to the makefile: -Disinff=isinf -Disnanf=isnan

The math lib checks the type already and uses one function

jianjunjiang commented 4 years ago

yes, you are right, isinff and isnanf are alias to isinf and isnan, following commit patched it. https://github.com/xboot/libonnx/commit/5ab486d7b196b621d6ef04f3a63f1261b466d103