https://github.com/tensorflow/swift Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories - + Security - * Team * Enterprise * Explore + Explore GitHub - Learn & contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Nonprofit - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} tensorflow / swift * Watch 280 * Star 5.9k * Fork 585 Swift for TensorFlow tensorflow.org/swift Apache-2.0 License 5.9k stars 585 forks Star Watch * Code * Issues 34 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights main 44 branches 0 tags Go to file Code Clone HTTPS GitHub CLI [https://github.com/t] Use Git or checkout with SVN using the web URL. [gh repo clone tensor] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio If nothing happens, download the GitHub extension for Visual Studio and try again. Go back Latest commit @ematejska ematejska Updating for Archiving of S4TF ... 1b1381c Feb 12, 2021 Updating for Archiving of S4TF 1b1381c Git stats * 596 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/disabled-workflows Disable `master` branch sync (#583) Dec 11, 2020 Sources/SIL Update branch references -> main (#577) Dec 1, 2020 Tests Remove quasiquotes from tensorflow/swift (#375) Jan 31, 2020 docs Updating for Archiving of S4TF Feb 12, 2021 images [README] Make logo background be transparent. (#588) Dec 21, 2020 notebooks Update branch references -> main (#577) Dec 1, 2020 proposals Update branch references -> main (#577) Dec 1, 2020 utils Remove python3, python3-pip and python3-setuptools install. They are ... Jan 21, 2021 .gitignore Data model and parser for SIL (#227) Aug 12, 2019 .swift-format Data model and parser for SIL (#227) Aug 12, 2019 BRANCHES.md Update branch references -> main (#577) Dec 1, 2020 CODE_OF_CONDUCT.md Use relative links, cleanup whitespace. Apr 26, 2018 Contributing.md Update branch references -> main (#577) Dec 1, 2020 FAQ.md Update branch references -> main (#577) Dec 1, 2020 Installation.md Staging 0.13 release toolchains for Ubuntu. (#607) Feb 11, 2021 KNOWN_ISSUES.md Update known issues. (#178) Nov 14, 2019 LICENSE Correct license to be Apache 2 instead of CC, as this repository cont... Aug 16, 2019 Package.swift Remove quasiquotes from tensorflow/swift (#375) Jan 31, 2020 README.md Updating the README with the archiving. Feb 12, 2021 RELEASES.md Update branch references -> main (#577) Dec 1, 2020 Usage.md Update branch references -> main (#577) Dec 1, 2020 View code README.md [logo] Swift for TensorFlow (In Archive Mode) Swift for TensorFlow was an experiment in the next-generation platform for machine learning, incorporating the latest research across machine learning, compilers, differentiable programming, systems design, and beyond. It was archived in February 2021. Some significant achievements from this project include: * Added language-integrated differentiable programming into the Swift language. This work continues in the official Swift compiler. * Developed a mutable-value-semantics-oriented deep learning API * Fostered the development of a model garden with more than 30 models from a variety of deep learning disciplines. * Enabled novel research that combines deep learning with probabilistic graphical models for 3D motion tracking and beyond. * Powered a(n almost) pure-Swift prototype of a GPU+CPU runtime supporting pmap. * Spun off multiple open source side efforts which continue to be under active development: + PythonKit: Python interoperability with Swift. + swift-jupyter: Enables use of Swift within Jupyter notebooks. + swift-benchmark: Provides a robust benchmarking suite for Swift code. * Spun off several other open source efforts: + penguin: Parallel programming, data structures, graph algorithms, and more. + Tensors Fitting Perfectly: Static analysis of tensor shape mismatches. * Swift-evolution proposals proposed and implemented: + SE-0195: User-defined "Dynamic Member Lookup" Types + SE-0216: Introduce user-defined dynamically "callable" types + SE-0233: Make Numeric Refine a new AdditiveArithmetic Protocol + SE-0253: Callable values of user-defined nominal types This site will not receive further updates. The API documentation and binary downloads will continue to be accessible as well as the Open Design Review meeting recordings. Getting started Using Swift for TensorFlow * Google Colaboratory: The fastest way to get started is to try out Swift for TensorFlow right in your browser. Just open up a tutorial, or start from a blank notebook! Read more in our usage guide. * Install locally: You can download a pre-built Swift for TensorFlow package. After installation, you can follow these step-by-step instructions to build and execute a Swift script on your computer. * Run on GCP: You can spin up a GCE instance using a Swift for TensorFlow Deep Learning VM image, with all drivers and the toolchain pre-installed. Instructions can be found in the Installation Guide. * Compile from source: If you'd like to customize Swift for TensorFlow or contribute back, follow our instructions on building Swift for TensorFlow from source. Tutorials [6874747073] Tutorial Last Updated A Swift Tour March 2019 Protocol-Oriented Programming & Generics August 2019 Python Interoperability March 2019 Custom Differentiation March 2019 Sharp Edges in Differentiability November 2020 Model Training Walkthrough March 2019 Raw TensorFlow Operators December 2019 Introducing X10, an XLA-Based Backend May 2020 Resources * Models and Examples * TensorFlow Swift API Reference * Release Notes * Known Issues * Frequently Asked Questions * TensorFlow Blog Posts Forums The discussions happened on the swift@tensorflow.org mailing list. Why Swift for TensorFlow? Swift for TensorFlow is a new way to develop machine learning models. It gives you the power of TensorFlow directly integrated into the Swift programming language. We believe that machine learning paradigms are so important that they deserve first-class language and compiler support. A fundamental primitive in machine learning is gradient-based optimization: computing function derivatives to optimize parameters. With Swift for TensorFlow, you can easily differentiate functions using differential operators like gradient(of:), or differentiate with respect to an entire model by calling method gradient(in:). These differentiation APIs are not just available for Tensor-related concepts--they are generalized for all types that conform to the Differentiable protocol, including Float, Double, SIMD vectors, and your own data structures. // Custom differentiable type. struct Model: Differentiable { var w: Float var b: Float func applied(to input: Float) -> Float { return w * input + b } } // Differentiate using `gradient(at:_:in:)`. let model = Model(w: 4, b: 3) let input: Float = 2 let (nablamodel, nablainput) = gradient(at: model, input) { model, input in model.applied(to: input) } print(nablamodel) // Model.TangentVector(w: 2.0, b: 1.0) print(nablainput) // 4.0 Beyond derivatives, the Swift for TensorFlow project comes with a sophisticated toolchain to make users more productive. You can run Swift interactively in a Jupyter notebook, and get helpful autocomplete suggestions to help you explore the massive API surface of a modern deep learning library. You can get started right in your browser in seconds! Migrating to Swift for TensorFlow is really easy thanks to Swift's powerful Python integration. You can incrementally migrate your Python code over (or continue to use your favorite Python libraries), because you can easily call your favorite Python library with a familiar syntax: import TensorFlow import Python let np = Python.import("numpy") let array = np.arange(100).reshape(10, 10) // Create a 10x10 numpy array. let tensor = Tensor(numpy: array) // Seamless integration! Documentation Beware: the project is moving very quickly, and thus some of these documents are slightly out of date as compared to the current state-of-the-art. Overview Document Last Updated Status Why Swift for TensorFlow? April 2018 Current Swift for TensorFlow Design Overview April 2018 Outdated Supported Backends May 2020 Current Technology deep dive The Swift for TensorFlow project builds on top of powerful theoretical foundations. For insight into some of the underlying technologies, check out the following documentation. Document Last Status Updated Swift Differentiable Programming Manifesto January Current 2020 Swift Differentiable Programming Implementation August Current Overview 2019 Swift Differentiable Programming Design Overview June 2019 Outdated Differentiable Types March 2019 Outdated Differentiable Functions and Differentiation APIs March 2019 Outdated Dynamic Property Iteration using Key Paths March 2019 Current Hierarchical Parameter Iteration and Optimization March 2019 Current First-Class Automatic Differentiation in Swift: A October Outdated Manifesto 2018 Automatic Differentiation Whitepaper April 2018 Outdated Python Interoperability April 2018 Current Graph Program Extraction April 2018 Outdated Source code Compiler and standard library development happens on the main branch of the apple/swift repository. Additional code repositories that make up the core of the project include: * Deep learning library: high-level API familiar to Keras users. Swift for TensorFlow is no longer a fork of the official Swift language; development was previously done on the tensorflow branch of the apple/swift repository. Language additions were designed to fit with the direction of Swift and are going through the Swift Evolution process. Jupyter Notebook support Jupyter Notebook support for Swift is under development at google/ swift-jupyter. Model garden tensorflow/swift-models is a repository of machine learning models built with Swift for TensorFlow. It intended to provide examples of how to use Swift for TensorFlow, to allow for end-to-end tests of machine learning APIs, and to host model benchmarking infrastructure. SwiftAI fastai/swiftai is a high-level API for Swift for TensorFlow, modeled after the fastai Python library. Community Swift for TensorFlow discussions happen on the swift@tensorflow.org mailing list. Bugs reports and feature requests Before reporting an issue, please check the Frequently Asked Questions to see if your question has already been addressed. For questions about general use or feature requests, please send an email to the mailing list or search for relevant issues in the JIRA issue tracker. For the most part, the core team's development is also tracked in JIRA. Contributing We welcome contributions from everyone. Read the contributing guide for information on how to get started. Code of conduct In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. The Swift for TensorFlow community is guided by our Code of Conduct, which we encourage everybody to read before participating. About Swift for TensorFlow tensorflow.org/swift Topics machine-learning tensorflow differentiable-programming Resources Readme License Apache-2.0 License Releases No releases published Packages 0 No packages published Contributors 64 * @dan-zheng * @rxwei * @marcrasi * @ematejska * @BradLarson * @saeta * @texasmichelle * @burmako * @mhong * @lattner * @bgogul + 53 contributors Languages * Jupyter Notebook 90.9% * Swift 8.8% * Other 0.3% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.