{"id":37755705,"url":"https://github.com/fszewczyk/shkyera-grad","last_synced_at":"2026-01-16T14:28:46.889Z","repository":{"id":206138357,"uuid":"618882579","full_name":"fszewczyk/shkyera-grad","owner":"fszewczyk","description":"micrograd, but in C++ and better","archived":false,"fork":false,"pushed_at":"2025-02-10T20:08:01.000Z","size":452,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T20:29:16.093Z","etag":null,"topics":["artificial-intelligence","autograd","machine-learning","micrograd","neural-network"],"latest_commit_sha":null,"homepage":"https://fszewczyk.github.io/shkyera-grad/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fszewczyk.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-03-25T16:17:27.000Z","updated_at":"2024-11-12T06:11:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d1aa0c1-6e8a-421a-b8c9-98f9f02ecc04","html_url":"https://github.com/fszewczyk/shkyera-grad","commit_stats":null,"previous_names":["fszewczyk/shkyera-grad"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/fszewczyk/shkyera-grad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fszewczyk%2Fshkyera-grad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fszewczyk%2Fshkyera-grad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fszewczyk%2Fshkyera-grad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fszewczyk%2Fshkyera-grad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fszewczyk","download_url":"https://codeload.github.com/fszewczyk/shkyera-grad/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fszewczyk%2Fshkyera-grad/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: 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":["artificial-intelligence","autograd","machine-learning","micrograd","neural-network"],"created_at":"2026-01-16T14:28:46.816Z","updated_at":"2026-01-16T14:28:46.875Z","avatar_url":"https://github.com/fszewczyk.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n \n\u003ch1\u003eShkyera Grad\u003c/h1\u003e\n\n\u003ci\u003e\nmicrograd, but in C++ and better.\n\u003c/i\u003e\n\u003cp\u003e\u003c/p\u003e\n\n[![Documentation](https://github.com/fszewczyk/shkyera-grad/actions/workflows/docs.yml/badge.svg)](https://fszewczyk.github.io/shkyera-grad/index.html)\n[![LinuxBuild](https://github.com/fszewczyk/shkyera-grad/actions/workflows/linux.yml/badge.svg)](https://github.com/fszewczyk/shkyera-grad/actions/workflows/linux.yml)\n[![MacOSBuild](https://github.com/fszewczyk/shkyera-grad/actions/workflows/macos.yml/badge.svg)](https://github.com/fszewczyk/shkyera-grad/actions/workflows/macos.yml)\n[![WindowsBuild](https://github.com/fszewczyk/shkyera-grad/actions/workflows/windows.yml/badge.svg)](https://github.com/fszewczyk/shkyera-grad/actions/workflows/windows.yml)\n[![LICENSE](https://img.shields.io/badge/license-Beerware-yellow)](https://github.com/fszewczyk/shkyera-grad/blob/master/LICENSE)\n\n\u003c/div\u003e\n\nThis is a small header-only library of a scalar-valued autograd based on [Andrej Karpathy's micrograd](https://github.com/karpathy/micrograd). It provides a high-level, PyTorch-like API for creating and training simple neural networks.\n\nIt supports multiple optimizers, such as Adam or SGD, all the most common activation functions and basic types of neural layers. All of it wrapped in a simple, header-only library.\n\n## Usage\n\nCheck out oour [Get Started Guide](https://fszewczyk.github.io/shkyera-grad/md_docs_tutorials_GetStarted.html) to learn the basics of _Shkyera Engine_.\n\n## Showcase\n\nHere's a small example showcasing a feed-forward network learning the XOR function. Check out the `examples/` folder for more examples.\n\n```cpp\n#include \"shkyera-grad/include/ShkyeraGrad.hpp\"\n\nint main() {\n    using namespace shkyera;\n    using T = Type::float32;\n\n    // This is our XOR dataset. It maps from Vec32 to Vec32\n    Dataset\u003cVec32, Vec32\u003e data;\n    data.addSample(Vec32::of(0, 0), Vec32::of(0));\n    data.addSample(Vec32::of(0, 1), Vec32::of(1));\n    data.addSample(Vec32::of(1, 0), Vec32::of(1));\n    data.addSample(Vec32::of(1, 1), Vec32::of(0));\n\n    // The is the data loader, it will take care of batching\n    size_t batchSize = 2;\n    bool shuffle = true;\n    DataLoader loader(data, batchSize, shuffle);\n\n    auto network = SequentialBuilder\u003cType::float32\u003e::begin()\n                    .add(Linear32::create(2, 15))\n                    .add(ReLU32::create())\n                    .add(Linear32::create(15, 5))\n                    .add(ReLU32::create())\n                    .add(Linear32::create(5, 1))\n                    .add(Sigmoid32::create())\n                    .build();\n\n    auto optimizer = Adam32(network-\u003eparameters(), 0.1);\n    auto lossFunction = Loss::MSE\u003cT\u003e;\n\n    for (size_t epoch = 0; epoch \u003c 100; epoch++) { // We train for 100 epochs\n        auto epochLoss = Val32::create(0);\n\n        optimizer.reset();                                                // Reset the gradients\n        for (const auto \u0026[x, y] : loader) {                               // For each batch\n            auto pred = network-\u003eforward(x);                              // We get some prediction\n            epochLoss = epochLoss + Loss::compute(lossFunction, pred, y); // And calculate its error\n        }\n        optimizer.step(); // Update the parameters\n\n        auto averageLoss = epochLoss / Val32::create(loader.getTotalBatches());\n        std::cout \u003c\u003c \"Epoch: \" \u003c\u003c epoch + 1 \u003c\u003c \" Loss: \" \u003c\u003c averageLoss-\u003egetValue() \u003c\u003c std::endl;\n    }\n\n    for (auto \u0026[x, y] : data) {          // Go through each example\n        auto pred = network-\u003eforward(x); // We get some prediction\n        std::cout \u003c\u003c x \u003c\u003c \" -\u003e \" \u003c\u003c pred[0] \u003c\u003c \"\\t| True: \" \u003c\u003c y[0] \u003c\u003c std::endl;\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffszewczyk%2Fshkyera-grad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffszewczyk%2Fshkyera-grad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffszewczyk%2Fshkyera-grad/lists"}