An ultra-light, ultra-flexible tensor library written in pure Nim. Intended for microcontrollers.
This library is part of the broader SteadyPCN framework for predictive coding, which is built around a few key principles:
- No dynamic memory allocation. This is to improve performance and to provide compile-time guarantees of memory usage. For many safety-critical applications, this is also considered a requirement / best practice.
- Configurable memory format. Tensors can be configured to be stored in either row-major or column-major order at compile time (just pass
-d:colMajorto the compiler for column-major, else it defaults to row-major), allowing optimization depending on the hardware available to you. - Configurable data types. Tensors can easily be configured to use any underlying data type, even custom ones. This aids in rapid prototyping of various low-bit architectures.
- Portable to new hardware. Porting to new hardware (including dedicated accelerators) is as easy as implementing the kernels on the hardware.
- No dependencies. Working with other TinyML frameworks can be a pain, as there are so many dependencies that can (and often do) give you problems. By avoiding dependencies, this framework is much easier to use, simpler to understand and debug, and less of a pain to set up and use.
If you want to accelerate this library on custom hardware (e.g., vector/SIMD instructions), just fork this repository and rewrite the kernels (in src/steadytensor/kernels.nim) with your own optimized implementations.
TODO: add instructions for installing forked library and using with SteadyPCN