-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Update TypeCheckAttr to infer what not to differentiate wrt for non-differentiable types. #22915
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
Conversation
|
@swift-ci please test tensorflow |
|
@dan-zheng is most familiar with this code path so I'll let him take a look first. My initial speculation is that the original attribute checking code was already checking |
By "infer |
|
Perhaps? isDifferentiableParam is the only part that overlaps. I suppose I could make a helper lambda that does isDifferentiableParam but takes a bool whether or not to emit errors? |
This happens when inferring default 'wrt:' for @differentiable. This should resolve: TF-296.
|
@swift-ci please test tensorflow |
2 similar comments
|
@swift-ci please test tensorflow |
|
@swift-ci please test tensorflow |
…ed! (#33) We've recently changed the type checker to improve the ergonomics of the `@differentiable` attribute. * [swiftlang/swift#22915](swiftlang/swift#22915): Explicit differentiation parameters are no longer required in a `@differentiable` attribute when the function has some arguments that do not conform to `Differentiable`. Those non-differentiable parameters will be skipped and the rest will be differentiated with respect to. * [swiftlang/swift#22877](swiftlang/swift#22877): On an instance method, when a `wrt:` is not specified, `self` is being implicitly included as a differentiation parameter. * [swiftlang/swift#22877](swiftlang/swift#22877): When a `@differentiable` requirement is not met, the `@differentiable` attribute fix-it will appear exactly as written in the original declaration instead of the most complex, canonical form. For instance, `@differentiable` instead of `@differentiable(wrt: (x))`. This greatly simplifies libraries and applications that use automatic differentiation. The protocol requirement `Layer.applied(to:in:)` becomes as simple as this: ```swift @differentiable func applied(to input: Input, in context: Context) -> Output ``` This PR updates deep learning APIs to use the simplest form of `@differentiable` possible. Hooray!
…wiftlang#22915) This happens when inferring default 'wrt:' for @differentiable. This should resolve: TF-296.
This happens when inferring default 'wrt:' for @differentiable.
This should resolve: TF-296.