{"id":13763378,"url":"https://github.com/endia-dev/endia","last_synced_at":"2025-05-10T16:32:28.017Z","repository":{"id":249110995,"uuid":"830493524","full_name":"endia-org/Endia","owner":"endia-org","description":"Scientific Computing in Mojo 🔥","archived":false,"fork":false,"pushed_at":"2024-08-02T12:32:06.000Z","size":5394,"stargazers_count":128,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-08-02T22:19:45.632Z","etag":null,"topics":["ai","arrays","compiler","jax","machine-learning","modular","mojo","numpy","python","pytorch"],"latest_commit_sha":null,"homepage":"https://endia.vercel.app","language":"Mojo","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/endia-org.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-18T11:35:53.000Z","updated_at":"2024-08-02T13:47:53.000Z","dependencies_parsed_at":"2024-08-01T21:40:48.177Z","dependency_job_id":null,"html_url":"https://github.com/endia-org/Endia","commit_stats":null,"previous_names":["endia-org/endia"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endia-org%2FEndia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endia-org%2FEndia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endia-org%2FEndia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endia-org%2FEndia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endia-org","download_url":"https://codeload.github.com/endia-org/Endia/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213819478,"owners_count":15643221,"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":["ai","arrays","compiler","jax","machine-learning","modular","mojo","numpy","python","pytorch"],"created_at":"2024-08-03T15:00:43.561Z","updated_at":"2025-05-10T16:32:28.001Z","avatar_url":"https://github.com/endia-org.png","language":"Mojo","funding_links":[],"categories":["🗂️ Libraries","Machine Learning"],"sub_categories":["AI"],"readme":"# Welcome to Endia 24.6\n\n**Endia** is a Machine Learning Framework written in pure Mojo, featuring:\n\n- **AD**: Compute derivatives of arbitrary order for training Neural Networks and beyond.\n- **Signal Processing:** Complex Numbers, Fourier Transforms, Convolution, and more.\n- **JIT Compilation:** Leverage the [MAX Engine](https://www.modular.com/) to speed up your code.\n- **Dual API:** Choose between a PyTorch-like imperative or a JAX-like functional interface.\n\nCheckout the [Endia documentation](https://endia.vercel) for more information.\n\n## Usage\n\n**Prerequisites: [Mojo 24.6](https://docs.modular.com/mojo/manual/get-started) 🔥 and [Magic](https://docs.modular.com/magic/)**\n\n### Option 1: Install the package for usage in your project\n\n- Add the Modular Community channel to your project's `.toml` file and install the package:\n\n  ```shell\n  magic project channel add \"https://repo.prefix.dev/modular-community\"\n  magic add endia\n  ```\n\n\n\n### Option 2: Clone the repository and run all examples, tests and benchmarks\n\n- **Clone the Repository**\n\n    ```shell\n    git clone https://github.com/endia-ai/Endia.git\n    cd Endia\n    magic shell\n    ```\n\n- **Run the Examples, Tests and Benchmarks**\n\n    ```shell\n    mojo run_all.mojo\n    ````\n\n    Recommended: Go to the `run_all.mojo` file and adjust the execution to your liking.\n\n####\n\n## A Simple Example - Computing Derivatives\n\nIn this guide, we'll demonstrate how to compute the **value**, **gradient**, and the **Hessian** (i.e. the second-order derivative) of a simple function. First by using Endia's Pytorch-like API and then by using a more Jax-like functional API. In both examples, we initially define a function **foo** that takes an array and returns the sum of the squares of its elements.\n\n### The **Pytorch** way\n\n\u003c!-- markdownlint-disable MD033 --\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pytorch.org/docs/stable/index.html\"\u003e\n    \u003cimg src=\"assets/pytorch_logo.png\" alt=\"Endia Logo\" width=\"40\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nWhen using Endia's imperative (PyTorch-like) interface, we compute the gradient of a function by calling the **backward** method on the function's output. This imperative style requires explicit management of the computational graph, including setting `requires_grad=True` for the input arrays (i.e. leaf nodes) and using `create_graph=True` in the backward method when computing higher-order derivatives.\n\n```python\nfrom endia import Tensor, sum, arange\nimport endia.autograd.functional as F\n\n\n# Define the function\ndef foo(x: Tensor) -\u003e Tensor:\n    return sum(x ** 2)\n\ndef main():\n    # Initialize variable - requires_grad=True needed!\n    x = arange(1.0, 4.0, requires_grad=True) # [1.0, 2.0, 3.0]\n\n    # Compute result, first and second order derivatives\n    y = foo(x)\n    y.backward(create_graph=True)            \n    dy_dx = x.grad()\n    d2y_dx2 = F.grad(outs=sum(dy_dx), inputs=x)[0]\n\n    # Print results\n    print(y)        # 14.0\n    print(dy_dx)    # [2.0, 4.0, 6.0]\n    print(d2y_dx2)  # [2.0, 2.0, 2.0]\n```\n\n### The **JAX** way\n\n\u003c!-- markdownlint-disable MD033 --\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://jax.readthedocs.io/en/latest/quickstart.html\"\u003e\n    \u003cimg src=\"assets/jax_logo.png\" alt=\"Endia Logo\" width=\"65\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nWhen using Endia's functional (JAX-like) interface, the computational graph is handled implicitly. By calling the `grad` or `jacobian` function on foo, we create a `Callable` which computes the full Jacobian matrix. This `Callable` can be passed to the `grad` or `jacobian` function again to compute higher-order derivatives.\n\n```python\nfrom endia import grad, jacobian\nfrom endia.numpy import sum, arange, ndarray\n\n\ndef foo(x: ndarray) -\u003e ndarray:\n    return sum(x**2)\n\n\ndef main():\n    # create Callables for the first and second order derivatives\n    foo_jac = grad(foo)\n    foo_hes = jacobian(foo_jac)\n\n    x = arange(1.0, 4.0)       # [1.0, 2.0, 3.0]\n\n    print(foo(x))              # 14.0\n    print(foo_jac(x)[ndarray]) # [2.0, 4.0, 6.0]\n    print(foo_hes(x)[ndarray]) # [[2.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 2.0]]\n```\n\n*And there is so much more! Endia can handle complex valued functions, can perform both forward and reverse-mode automatic differentiation, it even has a builtin JIT compiler to make things go brrr. Explore the full **list of features** in the [documentation](https://endia.vercel).*\n\n## Contributing\n\nContributions to Endia are welcome! If you'd like to contribute, please follow the contribution guidelines in the [CONTRIBUTING.md](https://github.com/endia-ai/Endia/blob/main/CONTRIBUTING.md) file in the repository.\n\n## License\n\nEndia is licensed under the [Apache-2.0 license with LLVM Exeptions](https://github.com/endia-ai/Endia/blob/main/LICENSE).\n\n## Happy Coding! 🚀\n\n\u003cdiv align=\"center\" style=\"max-width: 1000px; margin: auto;\"\u003e\n  \u003cimg src=\"./assets/title_image.png\" alt=\"Endia Title Image\" style=\"max-width: 100%;\" /\u003e\n\u003c/div\u003e\n\n### \n\n![CodeQL](https://github.com/endia-ai/Endia/workflows/CodeQL/badge.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendia-dev%2Fendia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fendia-dev%2Fendia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendia-dev%2Fendia/lists"}