Skip to content
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

[SR-12699] Improve diagnostic: "member is differentiable only with respect to a smaller subset of arguments" #55142

Open
dan-zheng opened this issue Apr 28, 2020 · 2 comments
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@dan-zheng
Copy link
Collaborator

Previous ID SR-12699
Radar None
Original Reporter @dan-zheng
Type Bug
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, AutoDiff, DiagnosticsQoI
Assignee None
Priority Medium

md5: 1a100cb5a0830ad23c99b5ef9f680b91

Issue Description:

Example diagnostic:

/home/michellecasbon/repos/tensorflow/texasmichelle/swift-apis/Sources/TensorFlow/Layer.swift:55:30: note: member is differentiable only with respect to a smaller subset of arguments
      let annotated = output.annotate(annotation)
                             ^

The diagnostic message makes sense but is not very helpful or actionable for users. We could improve that by:

  • Replacing "member" with the name of the referenced member, like Tensor.annotate here.

  • Mention the exact subsets of arguments that the member is differentiable with respect to.

@swift-ci
Copy link
Collaborator

swift-ci commented May 4, 2020

Comment by Fan Jiang (JIRA)

I encountered this today when implementing the generic `PriorFactor` by migrating the existing one specialized for `Pose2`. Is there a method to output some diagnostics before this issue is resolved?

Thanks a lot 🙂

@dan-zheng
Copy link
Collaborator Author

Is there a method to output some diagnostics before this issue is resolved?

If you'd like to see more debug output explaining non-differentiability errors, you can pass -Xllvm -debug-only=differentiation to swiftc.
If you're using SwiftPM, you can pass those flags via swift build -Xswiftc -Xllvm -Xswiftc -debug-only=differentiation.

bit.ly/swift-autodiff-debugging has more info. We compiler developers use the output to debug automatic differentiation behavior. It may be cryptic to users like you, so feel free to ask questions on the doc!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

2 participants