Commit Graph

37 Commits

Author SHA1 Message Date
Richard Wei
ab4cdc12dc [Docs] [AutoDiff] Improve wording in various places in the manifesto. 2020-08-07 15:42:24 -07:00
Dan Zheng
f3685f9a12 [AutoDiff] Conform Optional to Differentiable. (#32948)
Make `Optional` conditionally conform to `Differentiable` when the `Wrapped` type does.
`Optional.TangentVector` is a wrapper around `Wrapped.TangentVector?`.

Also, fix `Array.TangentVector.zeroTangentVectorInitializer`.

Resolves TF-1301.
2020-07-17 12:07:52 -07:00
Robert Widmann
cddf73ecdb [Gardening] Clean Up OS-Test Patterns Across The Codebase
Clean up a few general patterns that are now obviated by canImport

This aligns more generally with the cleanup that the Swift Package
Manager has already done in their automated XCTest-plumbing tool in
apple/swift-package-manager#1826.
2020-06-30 22:55:58 -07:00
Richard Wei
9964215bfe Update status to indicate feature gate 2020-06-29 20:25:39 -07:00
Dan Zheng
f9c5d7ae6c [AutoDiff] Derive Differentiable.zeroTangentVectorInitializer. (#31823)
`Differentiable` conformance derivation now supports
`Differentiable.zeroTangentVectorInitializer`.

There are two potential cases:
1. Memberwise derivation: done when `TangentVector` can be initialized memberwise.
2. `{ TangentVector.zero }` derivation: done as a fallback.

`zeroTangentVectorInitializer` is a closure that produces a zero tangent vector,
capturing minimal necessary information from `self`.

It is an instance property, unlike the static property `AdditiveArithmetic.zero`,
and should be used by the differentiation transform for correctness.

Remove `Differentiable.zeroTangentVectorInitializer` dummy default implementation.

Update stdlib `Differentiable` conformances and tests.
Clean up DerivedConformanceDifferentiable.cpp cruft.

Resolves TF-1007.
Progress towards TF-1008: differentiation correctness for projection operations.
2020-05-29 01:59:52 -07:00
Kshitij Patil
181477ffb2 Fix variable name in DifferentialProgramming.md
In Podcast Player example of Intelligent Systems, struct `Observation` has var `podcastState`, while it has been referenced as `state` in the following cell. Changed it to `podcastState`.
2020-05-03 23:40:33 +05:30
Richard Wei
dfb6f2078b [Docs] [AutoDiff] Allow implicitly inherited '@differentiable' on non-public declarations.
Currently, when a conforming type implements a `@differentiable` protocol requirement, the corresponding conforming implemnetation is required to have at least a `@differentiable` that covers all differentiability parameters in the protocol requirement.  However, this is not a great design for usability because developers almost always start with missing `@differentiable` and getting an compilation error.  This also makes ML models built with libraries that use differentiable programming more verbose than those built with other ML frameworks.

We agreed during this Friday's design review to allow `@differentiable` to be implicitly inherited from protocols when the conforming implementation is non-public.
2020-01-18 20:39:59 -08:00
swift-ci
1b0eee95e7 Merge pull request #28925 from apple/derivative-registration-typing-rules 2020-01-18 20:38:19 -08:00
Richard Wei
2a13bb0432 Remove duplicate paragraph. 2020-01-18 18:53:33 -08:00
Richard Wei
b5912e8267 Add missing 'T == T.TangentVector' requirement. 2020-01-18 18:50:50 -08:00
Richard Wei
893dd36327 Fix typo: 'foo' -> 'sinf' 2020-01-18 18:43:50 -08:00
Richard Wei
6df28a2816 Clarify the use of parameter indices and self. 2020-01-18 18:42:53 -08:00
Dan Zheng
d8d0f902fc [Docs] [AutoDiff] Fix typos in differentiable programming manifesto.
Add sections:
- Effect on ABI stability
- Effect on API resilience

These sections were incorrectly formatted when converting the doc to Markdown.
2020-01-13 06:53:38 -08:00
breandan
03fbf6598c Fix broken link 2019-12-30 06:38:02 -05:00
Richard Wei
a8e233fe47 [Docs] [AutoDiff] Add derivative/transpose registration typing rules. 2019-12-22 12:21:35 -08:00
swift-ci
9424f44ac8 Merge pull request #28768 from rxwei/correct-ad-builtins 2019-12-13 02:31:50 -08:00
Richard Wei
d4eb63fa03 [Docs] [AutoDiff] Correct AD builtins.
* `Builtin.autodiffApply*` has been renamed to `Builtin.applyDerivative*`.
  * The reason I'm not adding `_jvp` is because there will no longer be `_vjp`, which will make this suffix entirely unnecessary.
* The transpose application builtin is named `Builtin.applyTranspose*`.
2019-12-12 23:09:06 -08:00
Richard Wei
aa5ad262d6 Update docs/DifferentiableProgramming.md
Co-Authored-By: Bart Chrzaszcz <bart.chr@gmail.com>
2019-12-12 15:29:45 -08:00
Richard Wei
b40f076c1e Update docs/DifferentiableProgramming.md
Co-Authored-By: Bart Chrzaszcz <bart.chr@gmail.com>
2019-12-12 14:33:18 -08:00
Richard Wei
df68958ee8 Address review feedback. 2019-12-12 13:47:13 -08:00
Richard Wei
ec887ccdd7 Fix mis-reverted merge. 2019-12-12 13:38:39 -08:00
Richard Wei
e3b129efc7 Fix typo. 2019-12-12 13:37:48 -08:00
Richard Wei
be21aaf64b Merge branch 'master' of github.com:apple/swift into default-derivative 2019-12-12 13:36:31 -08:00
Richard Wei
f5d304c6ec [Docs] [AutoDiff] Add default derivative subsection and fix minor issues. 2019-12-12 13:33:10 -08:00
Dan Zheng
25bb2ca001 [Docs] [AutoDiff] Fix typos in differentiable programming manifesto.
- `@differential(linear)` -> `@differentiable(linear)`
- Fix derivative registration for `ElementaryFunctions` requirements.
2019-12-12 00:07:49 -08:00
Richard Wei
fb38f92eaa [Docs] [AutoDiff] Fix incorrectly rendered table and dead link 2019-12-11 15:16:17 -08:00
Richard Wei
e5935fba6c [Docs] [AutoDiff] Move higher-order functions out of future directions.
Differentiating higher-order functions is no longer a future direction, as the theory paper ([The Differentiable Curry](https://www.semanticscholar.org/paper/The-Differentiable-Curry-Plotkin-Brain/187078bfb159c78cc8c78c3bbe81a9176b3a6e02)) is now public.
2019-12-10 19:28:23 -08:00
Dan Zheng
51ebf99f5d [Docs] Fix typos in differentiable programming manifesto.
- Fix `Sequential` function builder usage.
- Fix grammatical error.
- `powerful machine learning` -> `expressive machine learning`
2019-12-02 12:39:50 -08:00
swift-ci
4c00d97b99 Merge pull request #28491 from dan-zheng/docs 2019-12-02 11:05:28 -08:00
Dan Zheng
292d76461a [Docs] Fix typos in differentiable programming manifesto.
- `Differentiable operators` -> `Differential operators`
- Fix incorrect `gradient(at:in:)` result type.
2019-11-26 18:15:56 -08:00
Richard Wei
7a9be4f09c Update markdown headers.
Co-Authored-By: Dan Zheng <danielzheng@google.com>
2019-11-22 23:06:46 -08:00
Richard Wei
ac16ac3b5a [Docs] [AutoDiff] Rename '@differentiating' and '@transposing' attributes.
In the code review for #28321, the main developers of AutoDiff agreed to rename `@differentiating` and `@transposing` to `@derivative(of:)` and `@transpose(of:)`, respectively.  This PR updates the manifesto to reflect this change.
2019-11-22 22:35:43 -08:00
Richard Wei
01b53db1b2 Remove a redundant paragraph. 2019-11-16 16:28:52 -08:00
Richard Wei
fa6c07d31d [Docs] [AutoDiff] Rename '@nondiff' to '@noDerivative'.
We agreed to move to rename `@nondiff` to `@noDerivative` (in line with the `@noDerivative` declaration attribute) in #28278.
2019-11-16 16:27:10 -08:00
Aubrey Mills
cd8f545836 Update DifferentiableProgramming.md (#28230)
Changed "Numerical computing in Swift Swift is an
expressive..." to "Numerical computing in Swift is an
expressive..."
2019-11-13 10:48:30 -08:00
Dan Zheng
51d7d6aec1 [Docs] Minor edits to differentiable programming manifesto. (#28200)
Polish "zero tangent vector initialization" doc comments.
2019-11-11 18:17:52 -08:00
Dan Zheng
07880d168f [Docs] Differentiable programming manifesto. (#27034) 2019-10-30 12:14:23 -07:00