{"id":19664841,"url":"https://github.com/fluxml/torch.jl","last_synced_at":"2025-10-26T19:32:39.010Z","repository":{"id":43731276,"uuid":"238165165","full_name":"FluxML/Torch.jl","owner":"FluxML","description":"Sensible extensions for exposing torch in Julia.","archived":false,"fork":false,"pushed_at":"2025-01-13T08:42:45.000Z","size":423,"stargazers_count":226,"open_issues_count":15,"forks_count":16,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-02-21T22:38:11.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","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/FluxML.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":"2020-02-04T09:11:22.000Z","updated_at":"2025-02-16T19:37:38.000Z","dependencies_parsed_at":"2024-08-08T18:12:32.309Z","dependency_job_id":"5242924f-88f3-45a4-bec0-d5e85f155093","html_url":"https://github.com/FluxML/Torch.jl","commit_stats":{"total_commits":178,"total_committers":13,"mean_commits":"13.692307692307692","dds":0.1966292134831461,"last_synced_commit":"52b18ebbef6461bb24fd051ab25014510377706f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluxML%2FTorch.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluxML%2FTorch.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluxML%2FTorch.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluxML%2FTorch.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FluxML","download_url":"https://codeload.github.com/FluxML/Torch.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240974463,"owners_count":19887302,"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-11-11T16:19:15.557Z","updated_at":"2025-10-26T19:32:33.952Z","avatar_url":"https://github.com/FluxML.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Torch.jl\n\n[![Build Status](https://github.com/FluxML/Torch.jl/actions/workflows/CI.yaml/badge.svg?branch=master)](https://github.com/FluxML/Torch.jl/actions/workflows/CI.yaml?query=branch%3Amaster)\n[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/JuliaDiff/BlueStyle)\n\nSensible extensions for exposing torch in Julia.\n\nThis package is aimed at providing the `Tensor` type, which offloads all computations over to [ATen](https://pytorch.org/cppdocs/), the foundational tensor library for PyTorch, written in C++.\n\n## Supported platforms\n\n| **Operating System** | **Architecture** | **Acceleration Runtime** |\n| --- | --- | --- |\n| macOS | aarch64 | - |\n| macOS | x86_64 | - |\n| Linux (glibc) | aarch64 | - |\n| Linux (glibc) | x86_64 | CUDA 10.2 |\n| Linux (glibc) | x86_64 | CUDA 11.3 |\n\nWindows support is pending, cf. [issue #26](https://github.com/FluxML/Torch.jl/issues/26).\n\nThe binary dependencies are available for Linux (glibc) on i686 (32-bit), but not all tests run succesfully.\n\n## Quick Start\n\nTo add the package, from the Julia REPL, enter the Pkg prompt by typing `]` and execute the following:\n```julia\npkg\u003e add Torch\n```\n\nOr via Julia's package manager Pkg.\n```julia\njulia\u003e using Pkg; Pkg.add(\"Torch\");\n```\n\n## Usage Example\n\n```julia\nusing Metalhead, Metalhead.Flux, Torch\nusing Torch: torch\n\nresnet = ResNet(18)\n```\n\nWe can move our object over to Torch via a simple call to `torch`\n\n```julia\ntresnet = resnet.layers |\u003e torch\n```\n\nOr if we need more control over the device to be used like so:\n\n```julia\nip = rand(Float32, 224, 224, 3, 1) # An RGB Image\ntip = tensor(ip, dev = 0) # 0 =\u003e GPU:0 in Torch\ncpu_tensor = tensor(ip, dev = -1) # -1 =\u003e CPU:0\n```\n\nCalling into the model is done via the usual Flux mechanism.\n\n```julia\ntresnet(tip);\n```\n\nWe can take gradients using Zygote as well\n\n```julia\ngs = gradient(x -\u003e sum(tresnet(x)), tip);\n\n# Or\n\nps = Flux.params(tresnet);\ngs = gradient(ps) do\n  sum(tresnet(tip))\nend\n```\n\n## Contributing and Issues\n\nPlease feel free to open issues you might encounter in the issue tracker.\nContributions through PRs toward corrections, increased\ncoverage, docs, etc. are most welcome.\n\n## Acknowledgements\n\nTakes a lot of inspiration from existing such projects, in particular [ocaml-torch](https://github.com/LaurentMazare/ocaml-torch), and [tch-rs](https://github.com/LaurentMazare/tch-rs).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluxml%2Ftorch.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluxml%2Ftorch.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluxml%2Ftorch.jl/lists"}