{"id":25179799,"url":"https://github.com/ajlekcahdp4/scalgrad","last_synced_at":"2025-04-04T04:26:26.686Z","repository":{"id":134215828,"uuid":"593584006","full_name":"ajlekcahdp4/scalgrad","owner":"ajlekcahdp4","description":"A tiny Autograd engine for C++ with small neural network on top","archived":false,"fork":false,"pushed_at":"2023-01-31T09:03:33.000Z","size":151,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T15:46:40.747Z","etag":null,"topics":["autograd","cpp","neural-networks"],"latest_commit_sha":null,"homepage":"","language":"C++","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/ajlekcahdp4.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":"2023-01-26T11:26:17.000Z","updated_at":"2024-11-14T18:36:58.000Z","dependencies_parsed_at":"2024-04-18T22:16:52.115Z","dependency_job_id":null,"html_url":"https://github.com/ajlekcahdp4/scalgrad","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/ajlekcahdp4%2Fscalgrad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajlekcahdp4%2Fscalgrad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajlekcahdp4%2Fscalgrad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajlekcahdp4%2Fscalgrad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajlekcahdp4","download_url":"https://codeload.github.com/ajlekcahdp4/scalgrad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247120333,"owners_count":20886891,"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":["autograd","cpp","neural-networks"],"created_at":"2025-02-09T15:46:36.251Z","updated_at":"2025-04-04T04:26:26.680Z","avatar_url":"https://github.com/ajlekcahdp4.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scalgrad\nA minimal C++ autograd engine implementation for scalars. Inspired by [micrograd](https://github.com/karpathy/micrograd). Also implemented small neural network on top of the engine.\n\n## Example\nHere is the example of engine usage:\n```cpp\n#include \"engine.hpp\"\n\nusing scal = typename red_engine::scalar\u003cdouble\u003e;\nint main() {\n  auto a = scal::create(2.0);\n  auto b = scal::create(3.0);\n  auto c = scal::create(4.0);\n  auto d = c - b;\n  auto r = red_engine::exponentiate((a + b) * c + d);\n  r-\u003ebackprop();\n  r-\u003edraw_dot(\"dump.dot\");\n```\n\nExample of the neural network usage:\n```cpp\n#include \"engine.hpp\"\n#include \"nn.hpp\"\n\nusing scal = typename red_engine::scalar\u003cdouble\u003e;\nint main() {\n  std::vector\u003cscal::pointer\u003e x{scal::create(1.0), scal::create(-2.0)};\n\n  auto n = nn::MLP\u003cdouble\u003e{2, {2, 1}};\n  auto tmp = n(x);\n  auto r = std::get\u003c1\u003e(tmp);\n  r-\u003ebackprop();\n  r-\u003edraw_dot(\"dump.dot\");\n}\n```\nThe graph of the neural network example is [here](example/example.png).\nYou can also try to run the [example](example/src/main.cc) yourself.\n\n## How to build\n```terminal\ngit clone git@github.com:ajlekcahdp4/scalgrad.git\ncd scalargrad\ncmake -S . -B build -DNOGTEST=False\nmake -C build -j8 install\n```\n## How to run (after build)\n```terminal\n# to run unit tests:\ncd build\nctest\n\n# to run the example\ncd example\nbin/example\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajlekcahdp4%2Fscalgrad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajlekcahdp4%2Fscalgrad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajlekcahdp4%2Fscalgrad/lists"}