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] Deprecate @differentiable(jvp:vjp:)
arguments.
#28932
[AutoDiff] Deprecate @differentiable(jvp:vjp:)
arguments.
#28932
Conversation
Deprecate `@differentiable` attribute `jvp:` and `vjp:` arguments for derivative registration. `@derivative` attribute is the canonical way to register derivatives. Update tests. TF-1001 tracks removing `@differentiable` attribute `jvp:` and `vjp:` arguments. TF-1085 tracks removing `@differentiable(jvp:vjp:)` usages in the stdlib.
@@ -1021,6 +1021,13 @@ bool Parser::parseDifferentiableAttributeArguments( | |||
{ label }); | |||
result.Name = parseDeclNameRef(result.Loc, funcDiag, | |||
DeclNameFlag::AllowZeroArgCompoundNames | DeclNameFlag::AllowOperators); | |||
// Emit warning for deprecated `jvp:` and `vjp:` arguments. | |||
// TODO(TF-1001): Remove deprecated `jvp:` and `vjp:` arguments. | |||
if (result.Loc.isValid()) { |
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: result.Loc
may not be valid if parseDeclNameRef
produces an error.
This can happen when jvp:vjp:
specifies a non-func
declaration, e.g. an init
or subscript
.
@swift-ci Please test tensorflow |
There'll be stdlib compilation warnings until |
Upstream changes from `tensorflow` branch: - apple#28932: deprecate `@differentiable(jvp:vjp)` arguments. - apple#29038: gardening. Additional gardening included.
Deprecate
@differentiable
attributejvp:
vjp:
arguments for derivativeregistration.
@derivative
attribute is the canonical way to registerderivatives.
Update tests.
TF-1001 tracks removing
@differentiable
attributejvp:
andvjp:
arguments.TF-1085 tracks removing
@differentiable(jvp:vjp:)
usages in the stdlib.Todo: upstream this PR to
master
.Example:
I decided not to invest time writing fully-fledged fix-its for rewriting
@differentiable(jvp:vjp:)
usages to@derivative
attribute, as it's slightly non-trivial. We can focus on retrodiff progress and manually rewriting@differentiable(jvp:vjp:)
usages instead.