Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elftausend/forward
A feed-forward-only neural network library, planned for embedded devices
https://github.com/elftausend/forward
compile-time const embedded embedded-devices fixed-size-array forward-propagation neural-network no-std rust
Last synced: about 1 month ago
JSON representation
A feed-forward-only neural network library, planned for embedded devices
- Host: GitHub
- URL: https://github.com/elftausend/forward
- Owner: elftausend
- License: mit
- Created: 2021-09-09T19:08:03.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-06T19:18:25.000Z (about 3 years ago)
- Last Synced: 2024-04-17T17:10:10.485Z (9 months ago)
- Topics: compile-time, const, embedded, embedded-devices, fixed-size-array, forward-propagation, neural-network, no-std, rust
- Language: Rust
- Homepage:
- Size: 95.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# forward
A feed-forward-only neural network library written in Rust, which uses fixed-size arrays.
## Example array-operations
```rust
use forward::{Forward, Sum, Transpose};fn main() {
//1x3 Matrix
let x = [2, 1, 3];
//3x2 Matrix
let y = [3, 1,
3, 6,
5, 3];
//vector(or 1 by x-matrix)-matrix multiply
//..Forward::..
let output = Forward::::forward(&x, &y);
assert_eq!(output, [24, 17]);
//sum all elements
let sum = Sum::compute(&output);
assert_eq!(sum, 41);//swap rows and cols
let transposed = Transpose::<_, 3, 2, 6>::compute(&y);
assert_eq!(transposed, [3, 3, 5,
1, 6, 3]);}
```## Example neural network
This is a neural network, which was trained to fit a sine wave.
```rust
use forward::{Linear, activation::{None, ReLU}, sine_net::{BIAS1, BIAS2, BIAS3, LAYER1, LAYER2, LAYER3}};
fn main() {
let linear1 = Linear::::new(LAYER1, BIAS1);
let linear2 = Linear::::new(LAYER2, BIAS2);
let linear3 = Linear::::new(LAYER3, BIAS3);let input = [0.555];
let x = linear1.forward(&input);
let x = linear2.forward(&x);
let x = linear3.forward(&x);println!("predicted: {:?}", x);
}```