TNT is a C++11 library for creating and manipulating N-dimensional tensors on the CPU. The library is a side project and is in very early stages of development. It is not suitable for production.
The library offers a large test suite, continuous integration and terrible documentation. The latter will be improved.
The library is designed with performance and simplicity of use and implementation as primary design considerations, leaning towards simplicity where trade-offs are considered. Benchmarks against Eigen and OpenCV are available for many operations.
The main contribution of the library is an N-Dimensional tensor object with a numeric type-
- unsigned:
uint8_t
,uint16_t
,uint32_t
,uint64_t
- signed:
int8_t
,int16_t
,int32_t
,int64_t
- floating:
float
,double
Half precision floats may be considered in the future. To enable both simplicity of implementation and high-performance, tensors always contain a single, contiguous block of memory. Non-contiguous slices of a tensor are represented as a non-owning view, which offer a subset of utility functions.
-
Core operations
- Per-element access
- Range based n-dimensional slicing
- Bidirectional iterators
- Copy and Move constructors
- Aligned memory allocation for SIMD
- SIMD accelerated Mask operations (<, <=, >, >=, ==, !=)
-
Math operations
- SIMD accelerated element operations (+, -, *, /)
- [] SIMD accelerated global and per axis summarization statistics (mean, median, mode, min, max)
- BLAS accelerated matrix multiplication
-
Linear algebra
- Eigenvector and Eigenvalue computation
- [] Discrete Fourier Transform
- [] Discrete Cosine Transform
- [] N-D Convolution
- [] Winograd's convolution algorithm for small kernels
-
Image processing
- [] JPEG compression / decompression
The library is header-only but has executables for testing and benchmarking. It uses CMake 3.X as its build system. To build and run the unit tests run-
cd <tnt_root>
mkdir build && cd build
cmake ..
make -j8
./tnt_tests
To run the benchmarks do-
cd <tnt_root>
mkdir build && cd build
cmake -DBUILD_TNT_BENCHMARKS=ON ..
make -j8
./benchmark/tnt_benchmarks