-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[AutoDiff] Conform Optional to Differentiable.
#32948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AutoDiff] Conform Optional to Differentiable.
#32948
Conversation
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.
|
cc @efremale |
| } | ||
|
|
||
| public static var zero: Self { | ||
| return Self(.zero) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: it seems more efficient to use Optional.TangentVector(nil) as Optional.TangentVector.zero. We can explore the implications when working on differentiation support for Optional.
|
@swift-ci Please smoke test |
|
We are seeing build failure on Swift CI, it might be related to this change. https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/5328/console |
|
Sorry about the test failure! I created #32981 to disable the test. |
Make
Optionalconditionally conform toDifferentiablewhen theWrappedtype does.Optional.TangentVectoris a wrapper aroundWrapped.TangentVector?, following the design in the Differentiable Programming Manifesto.Also, fix
Array.TangentVector.zeroTangentVectorInitializer.Resolves TF-1301.
Stepping stone towards differentiation support of optional-related operations: TF-1153.