Skip to content

crnumerics 0.8.0

Choose a tag to compare

@anun333 anun333 released this 14 Oct 05:13
· 36 commits to main since this release

crfix is on PyPI: pip install crfix gives its functions, lookup tables,
TFLite's affine formats and softmax on NumPy integer arrays. Its tests
use a second reference, independent of MPFR: Python's decimal and exact
fractions. Array functions in C (crfix_eval_n, crfix_eval_affine_n,
crfix_div_n) back it, and python -m crfix table prints a lookup table
as C source.

The affine formats and softmax have fast paths: an int8 lookup table in
13 to 26 µs instead of 0.9 to 2.4 ms, and softmax at 0.1 µs an element,
with the same results. Whatever the 64-bit enclosures leave undecided
still goes to the slow path.

crfix runs on a Cortex-M0. The build has no floating point and no
instruction beyond ARMv6-M, and a digest of 23 million results matches
the host's on 32-bit soft-float ARM and on the M0 itself, under qemu.

Two fixes to 0.7.0's affine formats and softmax:

  • With an output zero point, CRFIX_ZERO rounded y + zero point toward 0
    rather than y, as crfix.h specifies. With TFLite's logistic output,
    most inexact entries were one too large. The other modes were right.
  • exp and exp2 values from 2^62 up were saturated whatever the output
    scale, which was wrong for output scales above 2^30.

ival, crdist, crlin, crnn and lowp are unchanged but for the version
strings, now 0.8.0.