{"id":13672114,"url":"https://github.com/raskr/rust-autograd","last_synced_at":"2026-04-07T15:31:07.720Z","repository":{"id":45001650,"uuid":"102493316","full_name":"raskr/rust-autograd","owner":"raskr","description":"Tensors and differentiable operations (like TensorFlow) in Rust","archived":false,"fork":false,"pushed_at":"2023-02-11T06:38:39.000Z","size":1025,"stargazers_count":499,"open_issues_count":8,"forks_count":38,"subscribers_count":19,"default_branch":"master","last_synced_at":"2026-01-02T10:47:46.596Z","etag":null,"topics":["autograd","automatic-differentiation","deep-learning","machine-learning","neural-networks","rust","tensor"],"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/raskr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-05T14:42:39.000Z","updated_at":"2025-12-09T13:08:21.000Z","dependencies_parsed_at":"2024-11-11T10:41:42.574Z","dependency_job_id":null,"html_url":"https://github.com/raskr/rust-autograd","commit_stats":{"total_commits":358,"total_committers":16,"mean_commits":22.375,"dds":0.08379888268156421,"last_synced_commit":"b55c032e662f0bda420a296e7c5d56f4c9ef168d"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/raskr/rust-autograd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raskr%2Frust-autograd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raskr%2Frust-autograd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raskr%2Frust-autograd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raskr%2Frust-autograd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raskr","download_url":"https://codeload.github.com/raskr/rust-autograd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raskr%2Frust-autograd/sbom","scorecard":{"id":762386,"data":{"date":"2025-08-11","repo":{"name":"github.com/raskr/rust-autograd","commit":"b55c032e662f0bda420a296e7c5d56f4c9ef168d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/rust.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/rust.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/raskr/rust-autograd/rust.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/rust.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/raskr/rust-autograd/rust.yml/master?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T23:47:42.910Z","repository_id":45001650,"created_at":"2025-08-22T23:47:42.911Z","updated_at":"2025-08-22T23:47:42.911Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31518391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["autograd","automatic-differentiation","deep-learning","machine-learning","neural-networks","rust","tensor"],"created_at":"2024-08-02T09:01:27.089Z","updated_at":"2026-04-07T15:31:07.643Z","avatar_url":"https://github.com/raskr.png","language":"Rust","funding_links":[],"categories":["Rust","Differentiation"],"sub_categories":[],"readme":"# autograd\n\n[![build](https://github.com/raskr/rust-autograd/actions/workflows/rust.yml/badge.svg)](https://github.com/raskr/rust-autograd/actions/workflows/rust.yml)\n[![Crates.io version](https://img.shields.io/crates/v/autograd.svg)](https://crates.io/crates/autograd)\n[![docs.rs](https://docs.rs/autograd/badge.svg)](https://docs.rs/autograd/)\n\nTensors and differentiable operations backed by [ndarray](https://github.com/rust-ndarray/ndarray).\n\n## Cargo.toml\nIf you use basic linalg operations, especially matrix multiplications, `blas` feature would be important to speed them up. \n``` toml\n[dependencies]\nautograd = {\"\u003cversion\u003e\", features = [\"blas\", \"\u003cblas-implementation-choice\u003e\"] }\n```\n\n`\u003cblas-implementation-choice\u003e` must be one of the following (See also [blas-src](https://github.com/blas-lapack-rs/blas-src))\n- `accelerate` macOS only\n- `intel-mkl` Intel/AMD CPU only. Includes Vector Mathematics (VM) ops\n- `openblas`\n\n## Features\n### Reverse-mode automatic differentiation\nHere we are just computing partial derivatives of `z = 2x^2 + 3y + 1`.\n ```rust\nuse autograd as ag;\nuse ag::tensor_ops::*;\n\nag::run(|ctx: \u0026mut ag::Context\u003c_\u003e| {\n    let x = ctx.placeholder(\"x\", \u0026[]);\n    let y = ctx.placeholder(\"y\", \u0026[]);\n    let z = 2.*x*x + 3.*y + 1.;\n\n    // dz/dy\n    let gy = \u0026grad(\u0026[z], \u0026[y])[0];\n    println!(\"{:?}\", gy.eval(ctx));   // =\u003e Ok(3.)\n\n    // dz/dx (requires to fill the placeholder `x`)\n    let gx = \u0026grad(\u0026[z], \u0026[x])[0];\n    let feed = ag::ndarray::arr0(2.);\n    println!(\"{:?}\", ctx.evaluator().push(gx).feed(x, feed.view()).run()[0]);  // =\u003e Ok(8.)\n\n    // ddz/dx (differentiates `z` again)\n    let ggx = \u0026grad(\u0026[gx], \u0026[x])[0];\n    println!(\"{:?}\", ggx.eval(ctx));  // =\u003e Ok(4.)\n});\n ```\n\n ### Neural networks\n This crate has various low-level features inspired by tensorflow/theano to train neural networks.\n Since computation graphs require only bare minimum of heap allocations, the overhead is small, even for complex networks.\n ```rust\n// MNIST digits classification with multi-layer-perceptron\nuse autograd as ag;\nuse ag::optimizers::adam::Adam;\nuse ag::tensor_ops::*;\nuse ag::prelude::*;\n\nlet mut env = ag::VariableEnvironment::new();\n\nlet rng = ag::ndarray_ext::ArrayRng::\u003cf32\u003e::default();\n\n// Register variables in this env.\nenv.name(\"w\").set(rng.glorot_uniform(\u0026[28 * 28, 10]));\nenv.name(\"b\").set(ag::ndarray_ext::zeros(\u0026[1, 10]));\n\nlet adam = Adam::default(\"my_adam\", env.default_namespace().current_var_ids(), \u0026mut env);\n\nfor epoch in 0..3 {  // 0.11 sec/epoch on 2.7GHz Intel Core i5\n    env.run(|ctx| {\n        let x = ctx.placeholder(\"x\", \u0026[-1, 28*28]);\n        let y = ctx.placeholder(\"y\", \u0026[-1]);\n        let w = ctx.variable(\"w\");\n        let b = ctx.variable(\"b\");\n        let z = matmul(x, w) + b;\n        let mean_loss = reduce_mean(sparse_softmax_cross_entropy(z, \u0026y), \u0026[0], false);\n        let grads = \u0026grad(\u0026[mean_loss], \u0026[w, b]);\n\n        // let mut feeder = ag::Feeder::new();\n        // feeder.push(x, x_batch).push(y, y_batch);\n        // adam.update(\u0026[w, b], grads, ctx, feeder);\n    });\n}\n```\n\n### Abstractions\n```rust\nuse autograd as ag;\nuse ag::tensor_ops::*;\nuse ag::ndarray;\n\n// `Tensor::map()`\nag::run(|ctx| {\n    let x = ones(\u0026[2, 3], ctx);\n    // apply ndarray's methods\n    let y = x.map(|x| x.fold_axis(ndarray::Axis(0), 0.0, |acc, x| acc + x));\n    let z = x.map(|x| ag::ndarray_ext::zeros(x.shape()));\n});\n\n// Hooks\nag::run(|ctx| {\n    let x: ag::Tensor\u003cf32\u003e = ones(\u0026[2, 3], ctx).show_shape();\n    let y: ag::Tensor\u003cf32\u003e = ones(\u0026[2, 3], ctx).raw_hook(|x| println!(\"{}\", x));\n});\n```\n\nFor detailed, see [documentation](https://docs.rs/autograd/) or\n[examples](https://github.com/raskr/rust-autograd/tree/master/examples)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraskr%2Frust-autograd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraskr%2Frust-autograd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraskr%2Frust-autograd/lists"}