Skip to content

[AutoDiff] Add Differentiable.zeroTangentVectorInitializer. #28416

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

Conversation

dan-zheng
Copy link
Contributor

@dan-zheng dan-zheng commented Nov 21, 2019

The Differentiable.zeroTangentVectorInitializer requirement will enable
correct, efficient differentiation of struct property and tuple element accesses.

A zeroTangentVectorInitializer closure is more efficient than a
zeroTangentVector computed property, which would always capture self.

Add Differentiable.zeroTangentVector default instance property, which
returns self.zeroTangentVectorInitializer().

Todos:

  • Implement derived conformances for zeroTangentVectorInitializer.
  • Implement differentiation transform support for
    zeroTangentVectorInitializer and struct/tuple projection instructions.

Mirror of #28310 (with minor edits), which was merged but became lost in the
tensorflow branch commit history for some reason.

The `Differentiable.zeroTangentVectorInitializer` requirement will enable
correct, efficient reverse-mode differentiation of struct property accesses.

A `zeroTangentVectorInitializer` closure is more efficient than a
`zeroTangentVector` computed property, which would always capture `self`.

Add `Differentiable.zeroTangentVector` default instance property, which
returns `self.zeroTangentVectorInitializer()`.

Todos:
- Implement derived conformances for `zeroTangentVectorInitializer`.
- Implement differentiation transform support for
  `zeroTangentVectorInitializer` and struct/tuple projection instructions.
@dan-zheng dan-zheng added the tensorflow This is for "tensorflow" branch PRs. label Nov 21, 2019
@dan-zheng dan-zheng requested review from rxwei and marcrasi November 21, 2019 18:43
@dan-zheng
Copy link
Contributor Author

I didn't add any tests for now because I don't think there's anything meaningful to test yet.

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

@rxwei
Copy link
Contributor

rxwei commented Nov 21, 2019

The Differentiable.zeroTangentVectorInitializer requirement will enable
correct, efficient reverse-mode differentiation of struct property accesses.

Also for forward-mode, because JVP should return a differential that does not capture unnecessary information from the original code.

  • Implement differentiation transform support for
    zeroTangentVectorInitializer and struct/tuple projection instructions.

My earlier work in progress can be found here: rxwei@936791e.

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow linux

@dan-zheng
Copy link
Contributor Author

dan-zheng commented Nov 25, 2019

I'll merge after filing issues for todos (zeroTangentVectorInitializer derived conformances and transform support).

Edit: TF-1005 tracks per-instance zero tangent vector initialization.

@dan-zheng dan-zheng merged commit 682958a into swiftlang:tensorflow Nov 26, 2019
@dan-zheng dan-zheng deleted the zero-tangent-initialization branch November 26, 2019 17:19
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.

3 participants