Skip to content

Commit 0b53a02

Browse files
committed
[AutoDiff] Rename 'in:' to 'of:' in differential operators.
Rename the argument label `in:` in `gradient(at:in:)`, `pullback(at:in:)`, etc to `of:`, as suggested in the [pitch thread](https://forums.swift.org/t/differentiable-programming-for-gradient-based-machine-learning/42147).
1 parent 8bc6143 commit 0b53a02

38 files changed

+765
-765
lines changed

benchmark/single-source/Differentiation.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public func run_DifferentiationIdentity(N: Int) {
4040
x
4141
}
4242
for _ in 0..<1000*N {
43-
blackHole(valueWithGradient(at: 1, in: f))
43+
blackHole(valueWithGradient(at: 1, of: f))
4444
}
4545
}
4646

@@ -50,7 +50,7 @@ public func run_DifferentiationSquare(N: Int) {
5050
x * x
5151
}
5252
for _ in 0..<1000*N {
53-
blackHole(valueWithGradient(at: 1, in: f))
53+
blackHole(valueWithGradient(at: 1, of: f))
5454
}
5555
}
5656

@@ -66,7 +66,7 @@ public func run_DifferentiationArraySum(N: Int) {
6666
return result
6767
}
6868
for _ in 0..<N {
69-
blackHole(valueWithGradient(at: onesArray, in: sum))
69+
blackHole(valueWithGradient(at: onesArray, of: sum))
7070
}
7171
}
7272

docs/DifferentiableProgramming.md

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ The ability to get derivatives of programs enables a new world of numerical
141141
computing applications, notably machine learning. With first-class support,
142142
gradient-based learning algorithms can even be built using standard library
143143
types such as `Float` and `SIMD64<Float>` and be differentiated using
144-
protocol-oriented APIs such as `valueWithGradient(at:in:)`.
144+
protocol-oriented APIs such as `valueWithGradient(at:of:)`.
145145

146146
```swift
147147
struct Perceptron: @memberwise Differentiable {
148-
var weight: SIMD2<Float> = .random(in: -1..<1)
148+
var weight: SIMD2<Float> = .random(of: -1..<1)
149149
var bias: Float = 0
150150

151151
@differentiable
@@ -2171,7 +2171,7 @@ derivative in `B.swift`.
21712171
internal func foo(_ x: Float) -> Float {
21722172
x * x
21732173
}
2174-
let dfdx_A = derivative(at: 3, in: foo)
2174+
let dfdx_A = derivative(at: 3, of: foo)
21752175
// dfdx_A ==> 6
21762176

21772177
// File B.swift:
@@ -2182,11 +2182,11 @@ fileprivate func _(_ x: Float) -> (
21822182
) {
21832183
(value: foo(x), differential: { _ in 42 })
21842184
}
2185-
let dfdx_B = derivative(at: 3, in: foo)
2185+
let dfdx_B = derivative(at: 3, of: foo)
21862186
// dfdx_B ==> 42
21872187

21882188
// File C.swift:
2189-
let dfdx_C = derivative(at: 3, in: foo)
2189+
let dfdx_C = derivative(at: 3, of: foo)
21902190
// dfdx_C ==> 6
21912191
```
21922192

@@ -2496,13 +2496,13 @@ inputs and return derivative functions or evaluate derivative values.
24962496
#### Differential-producing differential operators
24972497

24982498
Among these differential operators, two base APIs,
2499-
`valueWithDifferential(at:in:)` and `transpose(of:)`, are used for implementing
2499+
`valueWithDifferential(at:of:)` and `transpose(of:)`, are used for implementing
25002500
*all other differential operators and differentiation APIs*.
25012501

25022502
```swift
25032503
/// Returns `body(x)` and the differential of `body` at `x`.
25042504
func valueWithDifferential<T, R>(
2505-
at x: T, in body: @differentiable (T) -> R
2505+
at x: T, of body: @differentiable (T) -> R
25062506
) -> (value: R,
25072507
differential: @differentiable(linear) (T.TangentVector) -> R.TangentVector) {
25082508
// Compiler built-in.
@@ -2525,60 +2525,60 @@ function whose parameter is a real number.
25252525

25262526
```swift
25272527
func valueWithDerivative<T: FloatingPoint, R>(
2528-
at x: T, in body: @differentiable (T) -> R
2528+
at x: T, of body: @differentiable (T) -> R
25292529
) -> (value: R, derivative: R.TangentVector) where T.TangentVector: FloatingPoint {
2530-
let (value, df) = valueWithDifferential(at: x, in: body)
2530+
let (value, df) = valueWithDifferential(at: x, of: body)
25312531
return (value, df(T.TangentVector(1)))
25322532
}
25332533

25342534
func derivative<T: FloatingPoint, R>(
2535-
at x: T, in body: @differentiable (T) -> R
2535+
at x: T, of body: @differentiable (T) -> R
25362536
) -> R.TangentVector where T.TangentVector: FloatingPoint {
2537-
valueWithDerivative(at: x, in: body).derivative
2537+
valueWithDerivative(at: x, of: body).derivative
25382538
}
25392539

25402540
func derivative<T: FloatingPoint, R>(
25412541
of body: @escaping @differentiable (T) -> R
25422542
) -> (T) -> R.TangentVector where T.TangentVector: FloatingPoint {
2543-
return { x in derivative(at: x, in: body) }
2543+
return { x in derivative(at: x, of: body) }
25442544
}
25452545
```
25462546

25472547
#### Pullback-producing differential operators
25482548

25492549
Unlike directional derivatives, gradients are computed by pullbacks. Based on
25502550
the differential-producing differential operator
2551-
`valueWithDifferential(at:in:)`, `valueWithPullback(at:in:)` is defined as
2551+
`valueWithDifferential(at:of:)`, `valueWithPullback(at:of:)` is defined as
25522552
returning the original value and the transpose of the differential, and
2553-
`valueWithGradient(at:in:)` is defined as evaluating the pullback at `1` when
2553+
`valueWithGradient(at:of:)` is defined as evaluating the pullback at `1` when
25542554
the function being differentiated returns a real number.
25552555

25562556
```swift
25572557
func valueWithPullback<T, R>(
2558-
at x: T, in body: @differentiable (T) -> R
2558+
at x: T, of body: @differentiable (T) -> R
25592559
) -> (value: R,
25602560
pullback: @differentiable(linear) (R.TangentVector) -> T.TangentVector) {
2561-
let (value, df) = valueWithDifferential(at: x, in: body)
2561+
let (value, df) = valueWithDifferential(at: x, of: body)
25622562
return (value, transpose(of: df))
25632563
}
25642564

25652565
func valueWithGradient<T, R: FloatingPoint>(
2566-
at x: T, in body: @differentiable (T) -> R
2566+
at x: T, of body: @differentiable (T) -> R
25672567
) -> (value: R, gradient: T.TangentVector) where R.TangentVector: FloatingPoint {
2568-
let (value, pullback) = valueWithPullback(at: x, in: body)
2568+
let (value, pullback) = valueWithPullback(at: x, of: body)
25692569
return (value, pullback(R.TangentVector(1)))
25702570
}
25712571

25722572
func gradient<T, R: FloatingPoint>(
2573-
at x: T, in body: @differentiable (T) -> R
2573+
at x: T, of body: @differentiable (T) -> R
25742574
) -> T.TangentVector where R.TangentVector: FloatingPoint {
2575-
return valueWithGradient(at: x, in: body).gradient
2575+
return valueWithGradient(at: x, of: body).gradient
25762576
}
25772577

25782578
func gradient<T, R: FloatingPoint>(
25792579
of body: @escaping @differentiable (T) -> R
25802580
) -> (T) -> T.TangentVector where R.TangentVector: FloatingPoint {
2581-
return { x in gradient(at: x, in: body) }
2581+
return { x in gradient(at: x, of: body) }
25822582
}
25832583
```
25842584

@@ -2608,14 +2608,14 @@ for _ in 0..<1000 {
26082608
Differential operators | Description
26092609
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -----------
26102610
[`transpose(of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L374) | Returns transpose of linear map.
2611-
[`valueWithDifferential(at:in:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L383) <br> [`valueWithDifferential(at:_:in:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L390) (arity 2) | Returns original result and differential function.
2612-
[`valueWithPullback(at:in:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L276) <br> [`valueWithPullback(at:_:in:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L283) | Returns original result and pullback function.
2613-
[`differential(at:in:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L435) <br> [`differential(at:_:in:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L442) (arity 2) | Returns differential function.
2614-
[`pullback(at:in:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L302) <br> [`pullback(at:_:in:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L309) | Returns pullback function.
2615-
[`derivative(at:in:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L483) <br> [`derivative(at:_:in:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L491) (arity 2) | Returns partial derivatives with respect to arguments ("forward-mode").
2616-
[`gradient(at:in:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L384) <br> [`gradient(at:_:in:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L392) | Returns partial derivatives with respect to arguments ("reverse-mode").
2617-
[`valueWithDerivative(at:in:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L538) <br> [`valueWithDerivative(at:_:in:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L547) (arity 2) | Returns original result and partial derivatives with respect to arguments ("forward-mode").
2618-
[`valueWithGradient(at:in:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L327) <br> [`valueWithGradient(at:_:in:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L335) | Returns original result and partial derivatives with respect to arguments ("reverse-mode").
2611+
[`valueWithDifferential(at:of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L383) <br> [`valueWithDifferential(at:_:of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L390) (arity 2) | Returns original result and differential function.
2612+
[`valueWithPullback(at:of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L276) <br> [`valueWithPullback(at:_:of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L283) | Returns original result and pullback function.
2613+
[`differential(at:of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L435) <br> [`differential(at:_:of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L442) (arity 2) | Returns differential function.
2614+
[`pullback(at:of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L302) <br> [`pullback(at:_:of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L309) | Returns pullback function.
2615+
[`derivative(at:of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L483) <br> [`derivative(at:_:of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L491) (arity 2) | Returns partial derivatives with respect to arguments ("forward-mode").
2616+
[`gradient(at:of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L384) <br> [`gradient(at:_:of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L392) | Returns partial derivatives with respect to arguments ("reverse-mode").
2617+
[`valueWithDerivative(at:of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L538) <br> [`valueWithDerivative(at:_:of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L547) (arity 2) | Returns original result and partial derivatives with respect to arguments ("forward-mode").
2618+
[`valueWithGradient(at:of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L327) <br> [`valueWithGradient(at:_:of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L335) | Returns original result and partial derivatives with respect to arguments ("reverse-mode").
26192619
[`derivative(of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L601) <br> [`derivative(of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L609) (arity 2) | Returns derivative function, taking original arguments and returning and partial derivatives with respect to arguments ("forward-mode").
26202620
[`gradient(of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L410) <br> [`gradient(of:)`](https://github.com/apple/swift/blob/c1211a3f78992c89a3ab4d638c378c6f45ab8fe8/stdlib/public/core/AutoDiff.swift#L418) | Returns gradient function, taking original arguments and returning and partial derivatives with respect to arguments ("reverse-mode").
26212621
[`valueWithDerivative(of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L656) <br> [`valueWithDerivative(of:)`](https://github.com/apple/swift/blob/9c95e27601e9623f5b53c9cc531d185e267a83d6/stdlib/public/core/AutoDiff.swift#L664) (arity 2) | Returns function taking original arguments and returning original result and partial derivatives with respect to arguments ("forward-mode").
@@ -2640,7 +2640,7 @@ transpose function or a derivative function, but not of functions that have not
26402640
been marked this way without defining a custom derivative for it. For example,
26412641
if we try to differentiate
26422642
[`sinf(_:)`](https://en.cppreference.com/w/c/numeric/math/sin) with the
2643-
`derivative(at:in:)` API, the compiler will produce error messages at
2643+
`derivative(at:of:)` API, the compiler will produce error messages at
26442644
compile-time instead of producing zero derivatives.
26452645

26462646
```swift
@@ -2965,26 +2965,26 @@ mean infinite differentiability.
29652965
func derivative<T: FloatingPoint, U: Differentiable>(
29662966
_ f: @differentiable (T) -> U
29672967
) -> @differentiable (T) -> U where T: FloatingPoint, T == T.TangentVector {
2968-
{ x in differential(at: x, in: f) }
2968+
{ x in differential(at: x, of: f) }
29692969
}
29702970
```
29712971

2972-
Since `derivative(of:)` is implemented in term of `derivative(at:in:)`, which is
2973-
implemented in terms of `valueWithDifferential(at:in:)`, both
2974-
`derivative(at:in:)` and `valueWithDifferential(at:in:)` would need to be marked
2972+
Since `derivative(of:)` is implemented in term of `derivative(at:of:)`, which is
2973+
implemented in terms of `valueWithDifferential(at:of:)`, both
2974+
`derivative(at:of:)` and `valueWithDifferential(at:of:)` would need to be marked
29752975
with `@differentiatiable` with respect to its `x` argument.
29762976

29772977
```swift
29782978
@differentiable(wrt: x)
29792979
func derivative<T: FloatingPoint, U: Differentiable>(
2980-
at x: T, in body: @differentiable (T) -> U) -> U
2980+
at x: T, of body: @differentiable (T) -> U) -> U
29812981
) -> U.TangentVector where T: FloatingPoint, T == T.TangentVector {
2982-
valueWithDifferential(at: x, in: body).differential(T(1))
2982+
valueWithDifferential(at: x, of: body).differential(T(1))
29832983
}
29842984

29852985
@differentiable(wrt: x)
29862986
func valueWithDifferential<T: FloatingPoint, U: Differentiable>(
2987-
at x: T, in body: @differentiable (T) -> U) -> U
2987+
at x: T, of body: @differentiable (T) -> U) -> U
29882988
) -> (value: U, differential: @differentiable(linear) (T.TangentVector) -> U.TangentVector)
29892989
```
29902990

stdlib/private/DifferentiationUnittest/DifferentiationUnittest.swift.gyb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,41 +325,41 @@ where T: Differentiable & FloatingPoint, T == T.TangentVector {
325325
// Differential operators for `${Self}<T>`.
326326

327327
public func gradient<T, R: FloatingPoint>(
328-
at x: T, in f: @differentiable(reverse) (T) -> ${Self}<R>
328+
at x: T, of f: @differentiable(reverse) (T) -> ${Self}<R>
329329
) -> T.TangentVector where R.TangentVector == R {
330-
return pullback(at: x, in: f)(1)
330+
return pullback(at: x, of: f)(1)
331331
}
332332

333333
public func gradient<T, U, R: FloatingPoint>(
334-
at x: T, _ y: U, in f: @differentiable(reverse) (T, U) -> ${Self}<R>
334+
at x: T, _ y: U, of f: @differentiable(reverse) (T, U) -> ${Self}<R>
335335
) -> (T.TangentVector, U.TangentVector) where R.TangentVector == R {
336-
return pullback(at: x, y, in: f)(1)
336+
return pullback(at: x, y, of: f)(1)
337337
}
338338

339339
public func derivative<T: FloatingPoint, R>(
340-
at x: ${Self}<T>, in f: @differentiable(reverse) (${Self}<T>) -> R
340+
at x: ${Self}<T>, of f: @differentiable(reverse) (${Self}<T>) -> R
341341
) -> R.TangentVector where T.TangentVector == T {
342-
return differential(at: x, in: f)(1)
342+
return differential(at: x, of: f)(1)
343343
}
344344

345345
public func derivative<T: FloatingPoint, U: FloatingPoint, R>(
346346
at x: ${Self}<T>, _ y: ${Self}<U>,
347-
in f: @differentiable(reverse) (${Self}<T>, ${Self}<U>) -> R
347+
of f: @differentiable(reverse) (${Self}<T>, ${Self}<U>) -> R
348348
) -> R.TangentVector where T.TangentVector == T, U.TangentVector == U {
349-
return differential(at: x, y, in: f)(1, 1)
349+
return differential(at: x, y, of: f)(1, 1)
350350
}
351351

352352
public func valueWithGradient<T, R: FloatingPoint>(
353-
at x: T, in f: @differentiable(reverse) (T) -> ${Self}<R>
353+
at x: T, of f: @differentiable(reverse) (T) -> ${Self}<R>
354354
) -> (value: ${Self}<R>, gradient: T.TangentVector) {
355-
let (y, pullback) = valueWithPullback(at: x, in: f)
355+
let (y, pullback) = valueWithPullback(at: x, of: f)
356356
return (y, pullback(1))
357357
}
358358

359359
public func valueWithDerivative<T: FloatingPoint, R>(
360-
at x: ${Self}<T>, in f: @differentiable(reverse) (${Self}<T>) -> R
360+
at x: ${Self}<T>, of f: @differentiable(reverse) (${Self}<T>) -> R
361361
) -> (value: R, derivative: R.TangentVector) {
362-
let (y, differential) = valueWithDifferential(at: x, in: f)
362+
let (y, differential) = valueWithDifferential(at: x, of: f)
363363
return (y, differential(1))
364364
}
365365

stdlib/public/Differentiation/ArrayDifferentiation.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ extension Array where Element: Differentiable {
351351
var values: [Result] = []
352352
var pullbacks: [(Result.TangentVector) -> Element.TangentVector] = []
353353
for x in self {
354-
let (y, pb) = valueWithPullback(at: x, in: body)
354+
let (y, pb) = valueWithPullback(at: x, of: body)
355355
values.append(y)
356356
pullbacks.append(pb)
357357
}
@@ -372,7 +372,7 @@ extension Array where Element: Differentiable {
372372
var values: [Result] = []
373373
var differentials: [(Element.TangentVector) -> Result.TangentVector] = []
374374
for x in self {
375-
let (y, df) = valueWithDifferential(at: x, in: body)
375+
let (y, df) = valueWithDifferential(at: x, of: body)
376376
values.append(y)
377377
differentials.append(df)
378378
}
@@ -411,7 +411,7 @@ extension Array where Element: Differentiable {
411411
var result = initialResult
412412
for element in self {
413413
let (y, pb) =
414-
valueWithPullback(at: result, element, in: nextPartialResult)
414+
valueWithPullback(at: result, element, of: nextPartialResult)
415415
result = y
416416
pullbacks.append(pb)
417417
}
@@ -447,7 +447,7 @@ extension Array where Element: Differentiable {
447447
var result = initialResult
448448
for element in self {
449449
let (y, df) =
450-
valueWithDifferential(at: result, element, in: nextPartialResult)
450+
valueWithDifferential(at: result, element, of: nextPartialResult)
451451
result = y
452452
differentials.append(df)
453453
}

0 commit comments

Comments
 (0)