PocketTensor is a [Kerasify](https://github.com/moof2k/kerasify) fork designed for running trained Keras models from a C++ application on embedded devices.
## Design goals
* Compatibility with sequential networks generated by Keras 2.x using Tensorflow backend.
* CPU support only (no GPU).
* Easy to build and run (no external dependencies).
* Unit tests for each supported layer.
## Improvements over Kerasify
* Thanks to the awesome [libsimdpp library](https://github.com/p12tic/libsimdpp), tensor operations have been rewritten using SIMD instructions to improve prediction performance.
* Memory (re)usage has been improved in order to reduce memory allocations.
* Apart from `float`, `double` precision tensors are supported (see `pt_tweakme.h` file).
* Tensor dimensions are rigorously validated on each layer to avoid bad models usage.
* Besides GCC and Clang, Visual Studio compiler is properly supported.
## Hardware requirements
Since there's no GPU support, by default PocketTensor requires the following CPU SIMD instruction sets:
* ARM: NEON with floating point support.
* x86: AVX.
Required SIMD instruction sets are specified in the `pt_tweakme.h` file, so they can be modified with ease.
## Software requirements
Since a copy of libsimdpp comes bundled with this library, there's no external dependencies required, so the only software requirements are a C++11-compatible compiler and CMake >= 3.4.
PocketTensor has been tested with these compilers:
* GCC 4.9.
* MSVC 2017.
* Whatever Clang comes with Apple LLVM 9.1.0.
## How to build
A CMakeLists.txt is provided with this library, so in order to use it you only need to include this file in your CMake project.
To build and run the unit tests, you need to generate them first: