-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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] Rename @differentiating
to @derivative(of:)
.
#28481
Conversation
Rename `@differentiating` to `@derivative(of:)`. `@derivative(of:)` more clearly evokes derivative registration; the syntax is otherwise unchanged. Deprecate `@differentiating`, to be removed in the next release. Discussed here: swiftlang#28321 (comment) Partially resolves TF-999. TF-1000 tracks updating all `@differentiating` usages across repositories.
|
||
/// SWIFT_ENABLE_TENSORFLOW | ||
ParserResult<DerivativeAttr> | ||
Parser::parseDifferentiatingAttribute(SourceLoc atLoc, SourceLoc loc) { |
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: I duplicated parseDifferentiatingAttribute
rather than adding a flag to parseDerivativeAttribute
to be future-facing. It's easier to remove duplicated code.
I avoided unnecessary/duplicate code in other places (e.g. not defining a new DifferentiatingAttr
class).
"'@differentiating' attribute requires function to return a two-element tuple of type " | ||
// @derivative | ||
ERROR(derivative_attr_expected_result_tuple,none, | ||
"'@derivative(of:)' attribute requires function to return a two-element tuple of type " |
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.
One topic to discuss is whether to show @derivative(of:)
or @derivative
in user-facing messages.
I chose @derivative(of:)
, following the precedent of dynamicReplacement(for:)
.
Code comments mostly use @derivative
without the label.
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.
@dynamicReplacement(for:)
doesn't take additional arguments like we do, but @derivative(of:wrt:)
is not good either. This works for me.
@swift-ci Please test tensorflow |
I'll merge this in order to get SR-11849 rolling. |
Rename
@differentiating
to@derivative(of:)
.@derivative(of:)
moreclearly evokes derivative registration; the syntax is otherwise unchanged.
Deprecate
@differentiating
, to be removed in the next release.Discussed here: #28321 (comment).
Partially resolves TF-999.
TF-1000 tracks updating all
@differentiating
usages across repositories.Confirmed via
grep -nr differentiating include lib stdlib test
that allremaining occurrences are intended.
Example: