Skip to content

[AutoDiff] Update differentiableFunction(from:) to use differentiable function constructor builtins. #28470

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

Merged
merged 2 commits into from
Nov 25, 2019

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Nov 25, 2019

This PR updates differentiableFunction(from:) to use differentiable function constructor builtins added in #28467. The standard library no longer has non-top-level derivative registration.

Resolves SR-11847. Unblocks SR-11849.

…le function constructor builtins.

This PR updates `differentiableFunction(from:)` to use differentiable function constructor builtins added in swiftlang#28467. The standard library no longer has non-top-level derivative registration.

Resolves SR-11847. Unblocks SR-11849.
@@ -212,39 +212,36 @@ public func withoutDerivative<T, R>(at x: T, in body: (T) -> R) -> R {
/// Create a differentiable function from a vector-Jacobian products function.
@inlinable
public func differentiableFunction<T : Differentiable, R : Differentiable>(
from vjp: @escaping (T)
from vjp: __owned @escaping (T)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if __owned convention is necessary to use Builtin.differentiableFunction?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it’s not necessary. It’s just a library optimization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I removed it because there's a bug that causes it not to parse when it's used with @escaping.

@rxwei
Copy link
Contributor Author

rxwei commented Nov 25, 2019

@swift-ci please test tensorflow

@rxwei
Copy link
Contributor Author

rxwei commented Nov 25, 2019

@swift-ci please test tensorflow

1 similar comment
@rxwei
Copy link
Contributor Author

rxwei commented Nov 25, 2019

@swift-ci please test tensorflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants