{"id":22604921,"url":"https://github.com/elftausend/forward","last_synced_at":"2025-03-28T21:28:53.947Z","repository":{"id":47140218,"uuid":"404840581","full_name":"elftausend/forward","owner":"elftausend","description":"A feed-forward-only neural network library, planned for embedded devices","archived":false,"fork":false,"pushed_at":"2021-12-06T19:18:25.000Z","size":98,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T07:45:49.706Z","etag":null,"topics":["compile-time","const","embedded","embedded-devices","fixed-size-array","forward-propagation","neural-network","no-std","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elftausend.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-09T19:08:03.000Z","updated_at":"2021-12-06T19:18:28.000Z","dependencies_parsed_at":"2022-09-04T00:40:15.827Z","dependency_job_id":null,"html_url":"https://github.com/elftausend/forward","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elftausend%2Fforward","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elftausend%2Fforward/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elftausend%2Fforward/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elftausend%2Fforward/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elftausend","download_url":"https://codeload.github.com/elftausend/forward/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246103336,"owners_count":20723938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compile-time","const","embedded","embedded-devices","fixed-size-array","forward-propagation","neural-network","no-std","rust"],"created_at":"2024-12-08T13:11:46.443Z","updated_at":"2025-03-28T21:28:53.923Z","avatar_url":"https://github.com/elftausend.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# forward\n\nA feed-forward-only neural network library written in Rust, which uses fixed-size arrays.\n\n## Example array-operations\n\n```rust\nuse forward::{Forward, Sum, Transpose};\n\nfn main() {\n    //1x3 Matrix \n    let x = [2, 1, 3];\n    //3x2 Matrix\n    let y = [3, 1,\n             3, 6, \n             5, 3];\n                    \n    //vector(or 1 by x-matrix)-matrix multiply                \n    //..Forward::\u003ci32, 3=cols of x/rows of y, 2=cols of y, 6=size of y\u003e..\n    let output = Forward::\u003ci32, 3, 2, 6\u003e::forward(\u0026x, \u0026y);\n    assert_eq!(output, [24, 17]);\n    \n    //sum all elements\n    let sum = Sum::compute(\u0026output);\n    assert_eq!(sum, 41);\n\n    //swap rows and cols\n    let transposed = Transpose::\u003c_, 3, 2, 6\u003e::compute(\u0026y);\n    assert_eq!(transposed, [3, 3, 5,\n                           1, 6, 3]);\n\n}\n```\n\n## Example neural network\n\nThis is a neural network, which was trained to fit a sine wave.\n\n```rust\n\nuse forward::{Linear, activation::{None, ReLU}, sine_net::{BIAS1, BIAS2, BIAS3, LAYER1, LAYER2, LAYER3}};\n\nfn main() {\n    let linear1 = Linear::\u003cf32, ReLU, 1, 64\u003e::new(LAYER1, BIAS1);\n    let linear2 = Linear::\u003cf32, ReLU, 64, 64\u003e::new(LAYER2, BIAS2);\n    let linear3 = Linear::\u003cf32, None, 64, 1\u003e::new(LAYER3, BIAS3);\n\n    let input = [0.555];\n    \n    let x = linear1.forward(\u0026input);\n    let x = linear2.forward(\u0026x);\n    let x = linear3.forward(\u0026x);\n\n    println!(\"predicted: {:?}\", x);\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felftausend%2Fforward","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felftausend%2Fforward","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felftausend%2Fforward/lists"}