Skip to content

[AutoDiff] Temporarily disable non-varied result warning. #26928

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 1 commit into from
Aug 29, 2019

Conversation

dan-zheng
Copy link
Contributor

@dan-zheng dan-zheng commented Aug 29, 2019

Previously, a warning and fixit was generated for differentiable functions
with non-varied results.

@differentiable
func nonVariedResult(_ x: Float) -> Float {
  .zero
}
tf-775.swift:3:3: warning: result does not depend on differentiation arguments and will always have a zero derivative; do you want to use 'withoutDerivative(at:)'?
  .zero
  ^
  withoutDerivative(at: )

However, TF-775 exposes that the fixit does not work and the warning is unsilenceable.

@differentiable
func nonVariedResult(_ x: Float) -> Float {
  withoutDerivative(at: .zero)
}
tf-775.swift:3:3: warning: result does not depend on differentiation arguments and will always have a zero derivative; do you want to use 'withoutDerivative(at:)'?
  withoutDerivative(at: .zero)
  ^
  withoutDerivative(at:       )

This patch temporarily disables the warning, as a robust fix requires non-trivial activity analysis changes. A lack of warning is better than an unsilenceable false positive.

TF-788 tracks re-enabling the warning.
Add regression test to ensure that unsilenceable warnings will not happen again.

@dan-zheng dan-zheng added the tensorflow This is for "tensorflow" branch PRs. label Aug 29, 2019
@dan-zheng dan-zheng requested a review from rxwei August 29, 2019 04:10
Previously, a warning and fixit was generated for differentiable functions
with non-varied results.

```
tf-775.swift:3:3: warning: result does not depend on differentiation
arguments and will always have a zero derivative; do you want to use
'withoutDerivative(at:)'?
  .zero
  ^
  withoutDerivative(at: )
```

However, TF-775 exposes that the fixit does not work and the warning is
unsilenceable.

This patch temporarily disables the warning, as a robust fix requires
non-trivial activity analysis changes. A lack of warning is better
than an unsilenceable false positive.

TF-788 tracks re-enabling the warning.
Add regression test to ensure that unsilenceable warnings will not
happen again.
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

@dan-zheng dan-zheng merged commit 483d399 into swiftlang:tensorflow Aug 29, 2019
@dan-zheng dan-zheng deleted the TF-775 branch August 29, 2019 09:53
dan-zheng added a commit to bartchr808/swift that referenced this pull request Sep 19, 2019
Follow-up to swiftlang#26928 for reverse-mode.
TF-788 tracks re-enabling the warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tensorflow This is for "tensorflow" branch PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants