{"id":16504490,"url":"https://github.com/ctgk/numgrad","last_synced_at":"2025-10-11T05:10:46.650Z","repository":{"id":39906110,"uuid":"285471083","full_name":"ctgk/numgrad","owner":"ctgk","description":"Simple gradient computation library in Python","archived":false,"fork":false,"pushed_at":"2024-10-06T02:27:06.000Z","size":459,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T10:11:31.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/ctgk.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}},"created_at":"2020-08-06T04:14:37.000Z","updated_at":"2024-09-28T00:28:32.000Z","dependencies_parsed_at":"2022-07-15T06:47:21.635Z","dependency_job_id":null,"html_url":"https://github.com/ctgk/numgrad","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":"ctgk/python-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctgk%2Fnumgrad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctgk%2Fnumgrad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctgk%2Fnumgrad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctgk%2Fnumgrad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctgk","download_url":"https://codeload.github.com/ctgk/numgrad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238578697,"owners_count":19495425,"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-11T15:03:26.366Z","updated_at":"2025-10-11T05:10:41.599Z","avatar_url":"https://github.com/ctgk.png","language":"Python","readme":"# NumGrad\n\nSimple gradient computation library for Python.\n\n# Getting Started\n\n```bash\npip install numgrad\n```\n\nInspired by [tensorflow](https://www.tensorflow.org/), `numgrad` supports [automatic differentiation](https://en.wikipedia.org/wiki/Automatic_differentiation) in tensorflow v2 style using original `numpy` and `scipy` functions.\n\n```python\n\u003e\u003e\u003e import numgrad as ng\n\u003e\u003e\u003e import numpy as np  # Original numpy\n\u003e\u003e\u003e\n\u003e\u003e\u003e # Pure numpy function\n\u003e\u003e\u003e def tanh(x):\n...     y = np.exp(-2 * x)\n...     return (1 - y) / (1 + y)\n...\n\u003e\u003e\u003e x = ng.Variable(1)\n\u003e\u003e\u003e with ng.Graph() as g:\n...     # numgrad patches numpy functions automatically here\n...     y = tanh(x)\n...\n\u003e\u003e\u003e g.backward(y, [x])\n(0.419974341614026,)\n\u003e\u003e\u003e (tanh(1.0001) - tanh(0.9999)) / 0.0002\n0.41997434264973155\n```\n\n`numgrad` also supports [jax](https://github.com/google/jax) style automatic differentiation.\n\n```python\n\u003e\u003e\u003e import numgrad as ng\n\u003e\u003e\u003e import numpy as np  # Original numpy unlike `jax`\n\u003e\u003e\u003e\n\u003e\u003e\u003e power_derivatives = [lambda a: np.power(a, 5)]\n\u003e\u003e\u003e for _ in range(6):\n...     power_derivatives.append(ng.grad(power_derivatives[-1]))\n...\n\u003e\u003e\u003e [f(2) for f in power_derivatives]\n[32, 80.0, 160.0, 240.0, 240.0, 120.0, 0.0]\n\u003e\u003e\u003e [f(-1) for f in power_derivatives]\n[-1, 5.0, -20.0, 60.0, -120.0, 120.0, -0.0]\n```\n\n# Contribute\n\nBe sure to run the following command before developing\n\n```bash\n$ git clone https://github.com/ctgk/numgrad.git\n$ cd numgrad\n$ pre-commit install\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctgk%2Fnumgrad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctgk%2Fnumgrad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctgk%2Fnumgrad/lists"}