{"id":46956328,"url":"https://github.com/onnxsim/onnxsim","last_synced_at":"2026-03-11T09:01:15.556Z","repository":{"id":37664070,"uuid":"178837505","full_name":"onnxsim/onnxsim","owner":"onnxsim","description":"Simplify your onnx model","archived":false,"fork":false,"pushed_at":"2026-02-20T17:08:59.000Z","size":494,"stargazers_count":4298,"open_issues_count":158,"forks_count":422,"subscribers_count":48,"default_branch":"master","last_synced_at":"2026-02-20T20:55:08.012Z","etag":null,"topics":["deep-learning","onnx","pytorch"],"latest_commit_sha":null,"homepage":"https://onnxsim.github.io/onnxsim/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onnxsim.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-04-01T10:12:34.000Z","updated_at":"2026-02-20T17:09:05.000Z","dependencies_parsed_at":"2023-02-19T16:05:16.320Z","dependency_job_id":"e82fb0f8-2fb0-4809-bc18-b4f583dc109a","html_url":"https://github.com/onnxsim/onnxsim","commit_stats":{"total_commits":283,"total_committers":15,"mean_commits":"18.866666666666667","dds":0.09893992932862195,"last_synced_commit":"72c1706bf59353506cf373bfc16d272c7d3082bc"},"previous_names":["onnxsim/onnxsim"],"tags_count":89,"template":false,"template_full_name":null,"purl":"pkg:github/onnxsim/onnxsim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onnxsim%2Fonnxsim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onnxsim%2Fonnxsim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onnxsim%2Fonnxsim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onnxsim%2Fonnxsim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onnxsim","download_url":"https://codeload.github.com/onnxsim/onnxsim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onnxsim%2Fonnxsim/sbom","scorecard":{"id":322299,"data":{"date":"2025-08-11","repo":{"name":"github.com/daquexian/onnx-simplifier","commit":"1379b1422e58cb085d976970a794d07a8d9593d8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/23 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build-and-test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:123: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:126: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:127: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:134: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:160: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:163: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:164: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:171: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:182: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:185: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:194: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:90: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:100: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:108: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-and-test.yml:115: update your workflow using https://app.stepsecurity.io/secureworkflow/daquexian/onnx-simplifier/build-and-test.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/build-and-test.yml:82","Warn: pipCommand not pinned by hash: .github/workflows/build-and-test.yml:83","Warn: pipCommand not pinned by hash: .github/workflows/build-and-test.yml:86","Warn: downloadThenRun not pinned by hash: .github/workflows/build-and-test.yml:153","Warn: downloadThenRun not pinned by hash: .github/workflows/build-and-test.yml:154","Info:   0 out of  11 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   9 third-party GitHubAction dependencies pinned","Info:   0 out of   2 downloadThenRun dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":2,"reason":"8 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6rq9-53c3-f7vj","Warn: Project is vulnerable to: PYSEC-2023-38 / GHSA-ffxj-547x-5j7c","Warn: Project is vulnerable to: PYSEC-2025-10 / GHSA-h36j-8vv3-cj52","Warn: Project is vulnerable to: PYSEC-2024-223 / GHSA-h8wv-9h96-m4hr","Warn: Project is vulnerable to: PYSEC-2024-222 / GHSA-whh8-fjgc-qp73","Warn: Project is vulnerable to: PYSEC-2022-48 / GHSA-77rm-9x9h-xj3g","Warn: Project is vulnerable to: GHSA-8gq9-2x98-w8hf","Warn: Project is vulnerable to: GHSA-8qvm-5x2c-j2w7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 10 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T01:40:27.820Z","repository_id":37664070,"created_at":"2025-08-18T01:40:27.821Z","updated_at":"2025-08-18T01:40:27.821Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30376758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"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":["deep-learning","onnx","pytorch"],"created_at":"2026-03-11T09:00:53.073Z","updated_at":"2026-03-11T09:01:15.537Z","avatar_url":"https://github.com/onnxsim.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ONNX Simplifier\n\n[![PyPI version](https://img.shields.io/pypi/v/onnxsim.svg)](https://pypi.python.org/pypi/onnxsim/)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/onnxsim.svg)](https://pypi.python.org/pypi/onnxsim/)\n[![PyPI license](https://img.shields.io/pypi/l/onnxsim.svg)](https://pypi.python.org/pypi/onnxsim/)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/onnxsim/onnxsim/pulls)\n[![Discord](https://img.shields.io/discord/1475920534847099121?logo=discord)](https://discord.gg/W3ht33v4)\n\n_ONNX is great, but sometimes too complicated._\n\n## Background\n\nOne day I wanted to export the following simple reshape operation to ONNX:\n\n```python\nimport torch\n\n\nclass JustReshape(torch.nn.Module):\n    def __init__(self):\n        super(JustReshape, self).__init__()\n\n    def forward(self, x):\n        return x.view((x.shape[0], x.shape[1], x.shape[3], x.shape[2]))\n\n\nnet = JustReshape()\nmodel_name = 'just_reshape.onnx'\ndummy_input = torch.randn(2, 3, 4, 5)\ntorch.onnx.export(net, dummy_input, model_name, input_names=['input'], output_names=['output'])\n```\n\nThe input shape in this model is static, so what I expected is\n\n![simple_reshape](imgs/simple_reshape.png)\n\nHowever, I got the following complicated model instead:\n\n![complicated_reshape](imgs/complicated_reshape.png)\n\n## Our solution\n\nONNX Simplifier is presented to simplify the ONNX model. It infers the whole computation graph\nand then replaces the redundant operators with their constant outputs (a.k.a. constant folding).\n\n### Web version\n\nWe have published ONNX Simplifier on [GitHub pages](https://onnxsim.github.io/onnxsim/). It works out of the box and **doesn't need any installation**. Note that it runs in the browser locally and your model is completely safe.\n\n### Python version\n\n\n```\npip3 install -U pip \u0026\u0026 pip3 install onnxsim\n```\n\nThen\n\n```\nonnxsim input_onnx_model output_onnx_model\n```\n\nFor more advanced features, try the following command for help message\n\n```\nonnxsim -h\n```\n\n## Demonstration\n\nAn overall comparison between\n[a complicated model](https://github.com/JDAI-CV/DNNLibrary/issues/17#issuecomment-455934190)\nand its simplified version:\n\n![Comparison between old model and new model](imgs/comparison.png)\n\n## In-script workflow\n\nIf you would like to embed ONNX simplifier python package in another script, it is just that simple.\n\n```python\nimport onnx\nfrom onnxsim import simplify\n\n# load your predefined ONNX model\nmodel = onnx.load(filename)\n\n# convert model\nmodel_simp, check = simplify(model)\n\nassert check, \"Simplified ONNX model could not be validated\"\n\n# use model_simp as a standard ONNX model object\n```\n\nYou can see more details of the API in [onnxsim/onnx_simplifier.py](onnxsim/onnx_simplifier.py)\n\n## Projects Using ONNX Simplifier\n\n* [MXNet](https://mxnet.apache.org/versions/1.9.1/api/python/docs/tutorials/deploy/export/onnx.html#Simplify-the-exported-ONNX-model)\n* [MMDetection](https://github.com/open-mmlab/mmdetection)\n* [YOLOv5](https://github.com/ultralytics/yolov5)\n* [ncnn](https://github.com/Tencent/ncnn)\n* ...\n\n## Chat\n\nWe created a Chinese QQ group for ONNX!\n\nONNX QQ Group (Chinese): 1021964010, verification code: nndab. Welcome to join!\n\nFor English users, I'm active on the [ONNX Slack](https://github.com/onnx/onnx#discuss). You can find and chat with me (daquexian) there.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonnxsim%2Fonnxsim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonnxsim%2Fonnxsim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonnxsim%2Fonnxsim/lists"}