{"id":17595171,"url":"https://github.com/takuseno/miniature","last_synced_at":"2025-04-12T07:12:43.956Z","repository":{"id":80512639,"uuid":"427592052","full_name":"takuseno/miniature","owner":"takuseno","description":"a toy deep learning library written in Rust","archived":false,"fork":false,"pushed_at":"2021-11-23T14:50:33.000Z","size":99,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T07:12:38.333Z","etag":null,"topics":[],"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/takuseno.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-13T06:55:07.000Z","updated_at":"2024-08-20T01:24:41.000Z","dependencies_parsed_at":"2023-04-01T15:33:34.353Z","dependency_job_id":null,"html_url":"https://github.com/takuseno/miniature","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/takuseno%2Fminiature","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuseno%2Fminiature/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuseno%2Fminiature/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuseno%2Fminiature/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takuseno","download_url":"https://codeload.github.com/takuseno/miniature/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530571,"owners_count":21119600,"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":[],"created_at":"2024-10-22T07:38:27.829Z","updated_at":"2025-04-12T07:12:43.914Z","avatar_url":"https://github.com/takuseno.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# miniature: a toy deep learning library written in Rust\n![MIT](https://img.shields.io/badge/license-MIT-blue)\n[![test](https://github.com/takuseno/miniature/actions/workflows/test.yaml/badge.svg)](https://github.com/takuseno/miniature/actions/workflows/test.yaml)\n\nA miniature is a toy deep learning library written in Rust.\n\nThe miniature is:\n- implemented for author's Rust practice.\n- designed as simple as possible.\n\nThe miniature is NOT:\n- supporting CUDA.\n- optimized for computational costs.\n- a product-ready library.\n\n## features\n- define-by-run style API\n- easy as Python libraries (e.g. TensorFlow, PyTorch, nnabla)\n- easy to add more features (e.g. layers, optimizers)\n\n## run MNIST\nDownload MNIST dataset for the first time.\n```\n$ python scripts/download_mnist.py\n```\n\nThen, run.\n```\n$ cargo run --release\n```\n\n\n## example\n```rs\nuse miniature::functions as F;\nuse miniature::graph::backward;\nuse miniature::optimizer as S;\nuse miniature::parametric_functions as PF;\nuse miniature::variable::Variable;\n\nuse std::rc::Rc;\nuse std::cell::RefCell;\n\nfn main() {\n    // define layers\n    let fc1 = PF::linear(28 * 28, 256);\n    let fc2 = PF::linear(256, 256);\n    let fc3 = PF::linear(256, 10);\n\n    // define optimizer\n    let mut optim = S::adam(0.001, (0.9, 0.999), 1e-8);\n    optim.set_params(fc1.get_params());\n    optim.set_params(fc2.get_params());\n    optim.set_params(fc3.get_params());\n\n    let x = Rc::new(RefCell::new(Variable::rand(vec![32, 28 * 28])));\n    let t = Rc::new(RefCell::new(Variable::rand(vec![32])));\n\n    // forward\n    let h1 = F::relu(fc1.call(x));\n    let h2 = F::relu(fc2.call(h1));\n    let y = fc3.call(h2);\n\n    // loss\n    let loss = F::cross_entropy_loss(y, F::onehot(t, 10));\n\n    // update\n    optim.zero_grad();\n    backward(loss);\n    optim.update();\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuseno%2Fminiature","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakuseno%2Fminiature","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuseno%2Fminiature/lists"}