{"id":19382841,"url":"https://github.com/locuslab/torchdeq","last_synced_at":"2026-03-06T10:32:10.117Z","repository":{"id":199898281,"uuid":"537516183","full_name":"locuslab/torchdeq","owner":"locuslab","description":"Modern Fixed Point Systems using Pytorch","archived":false,"fork":false,"pushed_at":"2023-10-31T09:42:03.000Z","size":221,"stargazers_count":115,"open_issues_count":5,"forks_count":13,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-09-23T07:33:52.701Z","etag":null,"topics":["deq","equilibrium","fixed-point","fixed-point-method"],"latest_commit_sha":null,"homepage":"","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/locuslab.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":"2022-09-16T15:30:21.000Z","updated_at":"2025-09-20T04:45:06.000Z","dependencies_parsed_at":"2024-11-10T09:36:51.288Z","dependency_job_id":null,"html_url":"https://github.com/locuslab/torchdeq","commit_stats":null,"previous_names":["locuslab/torchdeq"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/locuslab/torchdeq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Ftorchdeq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Ftorchdeq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Ftorchdeq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Ftorchdeq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locuslab","download_url":"https://codeload.github.com/locuslab/torchdeq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2Ftorchdeq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30171869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T07:56:45.623Z","status":"ssl_error","status_checked_at":"2026-03-06T07:55:55.621Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["deq","equilibrium","fixed-point","fixed-point-method"],"created_at":"2024-11-10T09:23:30.496Z","updated_at":"2026-03-06T10:32:10.088Z","avatar_url":"https://github.com/locuslab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://drive.google.com/uc?id=1tCXsv0yanvQqncB9ke8x6fCKonu4z4iB\" alt=\"TorchDEQ Logo\" width=\"65\" align=\"left\"\u003e\u003cdiv align=\"center\"\u003e\u003ch1\u003eTorchDEQ: A Library for Deep Equilibrium Models\u003c/h1\u003e\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\" height=\"20\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/torchdeq/\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/v/torchdeq\" alt=\"pypi\"heigh=\"20\"\u003e\n    \u003c/a\u003e\n    \u003ca href='https://torchdeq.readthedocs.io/en/latest/?badge=latest'\u003e\n        \u003cimg src='https://readthedocs.org/projects/torchdeq/badge/?version=latest' alt='Documentation Status' /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://torchdeq.readthedocs.io/en/latest/get_started.html\"\u003e\u003cb\u003eDocumentation\u003c/b\u003e\u003c/a\u003e \n• \n\u003ca href=\"https://colab.research.google.com/drive/12HiUnde7qLadeZGGtt7FITnSnbUmJr-I?usp=sharing\"\u003e\u003cb\u003eColab Tutorial\u003c/b\u003e\u003c/a\u003e •\n\u003ca href=\"https://torchdeq.readthedocs.io/en/latest/deq-zoo/model.html\"\u003e\u003cb\u003eDEQ Zoo\u003c/b\u003e\u003c/a\u003e\n•\n\u003ca href=\"TODO.md\"\u003e\u003cb\u003eRoadmap\u003c/b\u003e\u003c/a\u003e \n• \n\u003ca href=\"README.md#citation\"\u003e\u003cb\u003eCitation\u003c/b\u003e\u003c/a\u003e  \n\u003c/p\u003e\n\n## Introduction\n\nDeep Equilibrium Models, or DEQs, a recently developed class of implicit neural networks, merge the concepts of fixed point systems with modern deep learning. Fundamentally, DEQ models establish their output based on the equilibrium of nonlinear systems. This can be represented as:\n\n$$\\mathbf{z}^\\star=f_\\theta(\\mathbf{z}^\\star, \\mathbf{x})$$\n\nHere, $\\mathbf{x}$ is the input fed into the network, while $\\mathbf{z}^\\star$ stands as its output.\n\nEnter **TorchDEQ** - a fully featured, out-of-the-box, and PyTorch-based library tailored for the design and deployment of DEQs. It provides intuitive, decoupled, and modular interfaces to customize general-purpose DEQs for arbitrary tasks, all with just a handful of code lines.\n\nDive into the world of DEQ with TorchDEQ! Craft your own DEQ effortlessly in just a single line of code. Kickstart your journey with our [Colab Tutorial](https://colab.research.google.com/drive/12HiUnde7qLadeZGGtt7FITnSnbUmJr-I?usp=sharing) — best enjoyed with a comforting cup of tea!\n\n## Installation\n\n- Through pip.\n\n    ```bash\n    pip install torchdeq\n    ```\n\n- From source.\n\n    ```bash\n    git clone https://github.com/locuslab/torchdeq.git \u0026\u0026 cd torchdeq\n    pip install -e .\n    ```\n\n## Quick Start\n\n- Automatic arg parser decorator. You can call this function to add commonly used DEQ args to your program. \n\n```Python\nadd_deq_args(parser)\n```\n\n- Automatic DEQ instantiation. Call `get_deq` to get your DEQ layer in a single line! It's highly decoupled implementation agnostic to your model design.\n\n```Python\ndeq = get_deq(args)\n```\n\n- Easy DEQ forward. Even for a multi-equilibria system, you can execute your DEQ forward in a single line!\n\n```Python\n# Assume f is a function of three tensors a, b, c.\ndef fn(a, b, c):\n    # Do something here...\n    # Having the same input and output tensor shapes.\n    return a, b, c\n\n# A callable object (`fn` here) that defines your fixed point system.\n# `fn` can be a functor defined in your Pytorch forward function.\n# A functor can take your input injection from the local variables. \n# You can also pass a Pytorch Module into the DEQ class.\nz_out, info = deq(fn, (a0, b0, c0))\n```\n\n- Automatic DEQ backward. Gradients (both exact and inexact grad) are tracked automatically! Working with TorchDEQ is the same as other standard PyTorch operators. Just post-process ``z_out`` as normal tensors!\n\n## Contributions\n\nWe warmly welcome contributions to TorchDEQ from the community! If you have suggestions for improving the library, introducing new features, or identifying and fixing bugs, please open an issue to discuss with us! Once a direction has been discussed, we can proceed to build, test, and submit a pull request (PR) to TorchDEQ together. Keep a PR clean, well-tested, and have a single focus! While numerical errors and stability may seem minor initially, they can culminate in significant effects over time.\n\nWe have provided a preliminary [roadmap](TODO.md) for the development of this library and are always open to fresh perspectives. Feel free to reach out for questions, discussions, or library developments! Here is my [email](zhengyanggeng@gmail.com).\n\n## Logo Explained\n\nThe logo we’ve chosen draws inspiration from the ancient symbol, *[Ouroboros](https://en.wikipedia.org/wiki/Ouroboros)*, a powerful emblem depicting a serpent or dragon eternally consuming its own tail. Unearthed in the tomb of Tutankhamun, the Ouroboros symbolizes the cyclicality of time, embodying both creation and destruction, inception and conclusion. It’s a profound representation of infinity and wholeness, transcending various mythologies and philosophies across time.\n\nFor DEQ models, our choice of logo bears a metaphorical weight. The dragon, denoting $f(\\mathbf{x})$, biting its tail, representing $\\mathbf{x}$, paints a vivid picture of a function attaining a fixed point. It's a metaphor layered with meaning, visualizing the attainment of stability, illustrated by the dragon completing its circle by biting its tail. This symbol is not just a snapshot of equilibrium; it's a dynamic representation of the infinite nature inherent in DEQ models.\n\n## Citation\n\n```bibtex\n@misc{torchdeq,\n    author = {Zhengyang Geng and J. Zico Kolter},\n    title = {TorchDEQ: A Library for Deep Equilibrium Models},\n    year = {2023},\n    publisher = {GitHub},\n    journal = {GitHub repository},\n    howpublished = {\\url{https://github.com/locuslab/torchdeq}},\n}\n```\n\n## Acknowledgements\n\nThis codebase is largely inspired by remarkable projects from the community.\nWe would like to sincerely thank [DEQ](https://github.com/locuslab/deq), [DEQ-Flow](https://github.com/locuslab/deq-flow), [PyTorch](https://github.com/pytorch/pytorch), and [scipy](https://github.com/scipy/scipy) for their awesome open source.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Ftorchdeq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocuslab%2Ftorchdeq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Ftorchdeq/lists"}