Oxidosnel / differentiation

Incorporate experimental differentiation into Swift release toolchains

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Differentiation

A workaround for enabling differentiation in Swift until the standard library officially supports it. This is not needed in Swift development builds, and it may not reflect the most recent commits to the standard library.

Note: There are bugs in Swift's current implementation of differentiation. Proceed at your own risk.

How to Use

import Differentiation

struct Example: Differentiable {
    var x: Float
}

@differentiable(reverse)
func foo(x: Float) -> Float {
    ...
}

Demonstration

This package was been used in an iOS sample project to find velocity from physics equations.

About

Incorporate experimental differentiation into Swift release toolchains


Languages

Language:Swift 73.7%Language:Python 26.3%