{"id":49170995,"url":"https://github.com/tanaydesai/atomgrad","last_synced_at":"2026-04-22T19:01:12.167Z","repository":{"id":216702565,"uuid":"740078694","full_name":"tanaydesai/atomgrad","owner":"tanaydesai","description":"A simple vector valued autograd engine aimed to be between micrograd and tinygrad with a nn library.","archived":false,"fork":false,"pushed_at":"2024-01-14T15:03:05.000Z","size":181,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-03T04:18:18.651Z","etag":null,"topics":["machine-learning","micrograd","neural-network","pypi-package","pytorch","tinygrad"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/atomgrad/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tanaydesai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-07T13:15:31.000Z","updated_at":"2025-02-17T17:43:13.000Z","dependencies_parsed_at":"2024-01-14T14:12:39.373Z","dependency_job_id":null,"html_url":"https://github.com/tanaydesai/atomgrad","commit_stats":null,"previous_names":["tanaydesai/atomgrad"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tanaydesai/atomgrad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaydesai%2Fatomgrad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaydesai%2Fatomgrad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaydesai%2Fatomgrad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaydesai%2Fatomgrad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanaydesai","download_url":"https://codeload.github.com/tanaydesai/atomgrad/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaydesai%2Fatomgrad/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32150396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T17:06:48.269Z","status":"ssl_error","status_checked_at":"2026-04-22T17:06:19.037Z","response_time":58,"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":["machine-learning","micrograd","neural-network","pypi-package","pytorch","tinygrad"],"created_at":"2026-04-22T19:00:50.011Z","updated_at":"2026-04-22T19:01:12.070Z","avatar_url":"https://github.com/tanaydesai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# atomgrad\r\n\r\n![pic](pic.jpeg)\r\n\r\nAtomgrad is a simple autograd engine that aims to be between [micrograd](https://github.com/karpathy/micrograd/) and [tinygrad](https://github.com/tinygrad/tinygrad) that performs autodiff on vector-valued and scalar-valued tensors (atoms) coupled with a neural network api library.\r\n\r\n## Features\r\n\r\n- Supports Pytorch-like vector-valued and scalar-valued tensors.\r\n- Supports basic unary ops, binary ops, reduce ops and movement ops i.e (activn funcs, `sum`, `exp`, `reshape`, `randint`, `uniform`, etc).\r\n- Supports activation functions such as `relu`, `sigmoid`, `tanh`, etc.\r\n- Supports `binary_cross_entropy` \u0026 `binary_accuracy`.\r\n- Supports Graph Visualizations.\r\n\r\n## Installation\r\n\r\nYou can install atomgrad using pip:\r\n\r\n```bash\r\npip install atomgrad==0.3.0\r\n```\r\n\r\n## Usage\r\n\r\nHere is a simple example of using atomgrad to compute the gradient of a function:\r\n\r\n```python\r\nfrom atomgrad.atom import Atom\r\nfrom atomgrad.graph import draw_dot\r\n\r\n\r\n# create two tensors with gradients enabled\r\nx = Atom(2.0, requires_grad=True)\r\ny = Atom(3.0, requires_grad=True)\r\n\r\n# define a function\r\nz = x * y + x ** 2\r\n\r\n# compute the backward pass\r\nz.backward()\r\n\r\n# print the gradients\r\nprint(x.grad) # 7.0\r\nprint(y.grad) # 2.0\r\n\r\ndraw_dot(z)\r\n```\r\n![pic](graph.png)\r\n\r\nHere is a simple example of using atomgrad to train a one 16-node hidden layer neural network for binary classification.\r\n\r\n```python\r\nimport numpy as np\r\nfrom atomgrad.atom import Atom\r\nfrom atomgrad.nn import AtomNet, Layer\r\nfrom atomgrad.optim import SGD\r\nfrom atomgrad.metrics import binary_cross_entropy, binary_accuracy\r\n\r\n# create a model\r\nmodel = AtomNet(\r\n  Layer(2, 16),\r\n  Layer(16, 16),\r\n  Layer(16, 1)\r\n)\r\n# create an optimizer\r\noptim = SGD(model.parameters(), lr=0.01)\r\n\r\n# load some data\r\nx = [[2.0, 3.0, -1.0],\r\n  [3.0, -1.0, 0.5],\r\n  [0.5, 1.0, 1.0],\r\n  [1.0, 1.0, -1.0],\r\n  [0.0, 4.0, 0.5],\r\n  [3.0, -1.0, 0.5]]\r\ny = [1, 1, 0, 1, 0, 1]\r\n\r\nx = Atom(x)\r\ny = Atom(y)\r\n\r\nmodel.fit(x, y, optim, binary_cross_entropy, binary_accuracy, epochs=100)\r\n\r\n#output\r\n'''\r\n...\r\nepoch: 30 | loss: 0.14601783454418182  | accuracy: 100.0%\r\nepoch: 35 | loss: 0.11600304394960403  | accuracy: 100.0%\r\nepoch: 40 | loss: 0.09604986757040024  | accuracy: 100.0%\r\nepoch: 45 | loss: 0.0816292017698288  | accuracy: 100.0%\r\n'''\r\n```\r\n\r\n## Demos\r\n\r\nAn example of simple autodiff and four binary classifiers including `make_moons` dataset and MNIST digits dataset is in the `examples/demos.ipynb` notebook.\r\n\r\nNote: Although `atom.nn` includes `softmax` activation and `cat_cross_entropy`, model results are quite dissapointing and are likely due to some bug (plz lmk if you find it!). As a result the `AtomNet` model is best suited for binary classification neural net tasks.\r\n\r\n## Acknowledgement\r\n- [micrograd](https://github.com/karpathy/micrograd/) for the idea and inspring everyone!\r\n- [tinygrad](https://github.com/tinygrad/tinygrad)\r\n- [robingrad](https://github.com/marcosalvalaggio/robingrad)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanaydesai%2Fatomgrad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanaydesai%2Fatomgrad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanaydesai%2Fatomgrad/lists"}