Skip to main content

Crate embedded_nn

Crate embedded_nn 

Source
Expand description

§embedded-nn

embedded-nn is a pure Rust, #![no_std] neural network inference library for microcontrollers and embedded targets, inspired by ARM’s CMSIS-NN and TensorFlow Lite Micro.

§Modules

  • types: Dimensional shapes, parameter structures, error types.
  • support: Fixed-point quantization math, rounding division, bit operations.
  • activations: ReLU, ReLU6, LeakyReLU, Sigmoid, Tanh.
  • basic_math: Elementwise addition, subtraction, and multiplication.
  • convolution: 2D Convolution, 1x1 Convolution, Depthwise Convolution, Transposed Conv, 1D Temporal Conv.
  • fully_connected: Fully Connected (Linear / Dense) layers and Batch Matrix Multiplication (BatchMatMul).
  • pooling: Max Pooling, Average Pooling.
  • softmax: Softmax activation.
  • [concat]: Depthwise concatenation.
  • pad: Tensor padding.
  • transpose: Matrix and spatial transposition.
  • reshape: Reshaping operations.
  • simd: Target SIMD vectorization abstractions, ARM DSP SMLAD assembly, and dot-product acceleration.
  • subbyte: Sub-byte 4-bit (s4) quantization layers and packing helpers.
  • recurrent: Recurrent neural network layers (LSTM cell, SVDF filter with 8-bit & 16-bit state).
  • float_ops: Floating-point (f32 & IEEE-754 f16) fallback layers.

Re-exports§

pub use support::clamp;
pub use support::divide_by_power_of_two;
pub use support::doubling_high_mult_no_sat;
pub use support::pack_q15x2_32x1;
pub use support::pack_s8x4_32x1;
pub use support::requantize;
pub use support::requantize_s64;
pub use types::Activation;
pub use types::Context;
pub use types::ConvParams;
pub use types::Dims;
pub use types::DwConvParams;
pub use types::Error;
pub use types::FcParams;
pub use types::PerChannelQuantParams;
pub use types::PerTensorQuantParams;
pub use types::PoolParams;
pub use types::QuantParams;
pub use types::Result;
pub use types::SoftmaxParams;
pub use types::Tile;
pub use convolution::convolve_1_x_n_s8;
pub use convolution::transpose_conv_s8;
pub use float_ops::f16_to_f32;
pub use float_ops::f32_to_f16;
pub use fully_connected::batch_matmul_s16;
pub use fully_connected::batch_matmul_s8;
pub use recurrent::lstm_step_s16;
pub use recurrent::lstm_step_s8_s16;
pub use recurrent::svdf_s8;
pub use recurrent::svdf_state_s16_s8;
pub use recurrent::LstmGateParams;
pub use simd::vec_dot_s16;
pub use simd::vec_dot_s8;
pub use subbyte::convolve_s4;
pub use subbyte::fully_connected_s4;
pub use subbyte::pack_s4_pair;
pub use subbyte::unpack_s4_pair;

Modules§

activations
Activation functions for quantized tensors.
basic_math
Basic elementwise mathematical operations on quantized tensors.
concat
Concatenation operations along channel/depth dimension for quantized tensors.
convolution
Convolution layer operations for quantized neural networks.
float_ops
Floating-point (f32 and f16) fallback operations and layers.
fully_connected
Fully Connected (Linear / Dense) and Batch Matrix Multiplication operations.
pad
Tensor padding operations for quantized tensors.
pooling
Pooling layer operations (Max Pooling, Average Pooling) for quantized neural networks.
recurrent
Advanced recurrent neural network layers (LSTM, SVDF).
reshape
Tensor reshape operations.
simd
Target SIMD vectorization abstractions and acceleration hooks.
softmax
Softmax activation operations for quantized neural networks.
subbyte
Sub-byte 4-bit (s4) quantization operations and layers.
support
Fixed-point math and support helper functions for embedded-nn.
transpose
Tensor transpose operations.
types
Core types and parameter structures for embedded-nn.