Skip to content

[AutoDiff] Enable differentiation wrt "subset indices". #23887

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
Apr 9, 2019

Conversation

dan-zheng
Copy link
Contributor

Remove this error: function is differentiable only with respect to a smaller subset of arguments.

The differentiation pass (and "minimal indices" logic) actually supports
such differentiation wrt "subset indices". All that is needed is to remove
the deprecated error.

Remove this error: `function is differentiable only with respect to a
smaller subset of arguments`.

The differentiation pass (and "minimal indices" logic) actually supports
such differentiation wrt "subset indices". All that is needed is to remove
the deprecated error.
@dan-zheng dan-zheng added the tensorflow This is for "tensorflow" branch PRs. label Apr 9, 2019
@dan-zheng dan-zheng requested a review from rxwei April 9, 2019 14:39
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

@rxwei
Copy link
Contributor

rxwei commented Apr 9, 2019

Note that this may have unexpected memory issues. Should be looked at later.

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow macOS

@rxwei rxwei merged commit d21ea44 into swiftlang:tensorflow Apr 9, 2019
@dan-zheng dan-zheng deleted the fix-subset-diff branch April 9, 2019 16:22
rxwei added a commit that referenced this pull request Apr 11, 2019
…on types. (#23854)

This is to unblock `@differentiable` functions with `@nondiff` parameters. 

- Propagate `@nondiff` from AST to SIL.
- Add `AnyFunctionType::getWithoutDifferentiability`, which drops all `@differentiable` and `@nondiff` attributes from a function type.
- Use autodiff parameter indices from function types now that `@nondiff` has been propagated.
- Replace currying logic from `SILFunctionType::getAssociatedFunctionType` with lightweight logic that handles methods, which is needed for differentiable protocol requirements.
- Emit an error when a `@nondiff` parameter is being differentiated with respect to.
- Fix `@nondiff` AST printing.

Note: 
- Once `SILDifferentiableFunctionType` in #23482 lands, `@nondiff` should be nuked from SIL.
- Before merging, pull from the `tensorflow` branch to make sure #23887 is merged.

Resolves [TF-421](https://bugs.swift.org/browse/TF-421).
rxwei pushed a commit to rxwei/swift that referenced this pull request May 11, 2019
)

Remove this error: `function is differentiable only with respect to a
smaller subset of arguments`.

The differentiation pass (and "minimal indices" logic) actually supports
such differentiation wrt "subset indices". All that is needed is to remove
the deprecated error.
rxwei added a commit to rxwei/swift that referenced this pull request May 11, 2019
…on types. (swiftlang#23854)

This is to unblock `@differentiable` functions with `@nondiff` parameters. 

- Propagate `@nondiff` from AST to SIL.
- Add `AnyFunctionType::getWithoutDifferentiability`, which drops all `@differentiable` and `@nondiff` attributes from a function type.
- Use autodiff parameter indices from function types now that `@nondiff` has been propagated.
- Replace currying logic from `SILFunctionType::getAssociatedFunctionType` with lightweight logic that handles methods, which is needed for differentiable protocol requirements.
- Emit an error when a `@nondiff` parameter is being differentiated with respect to.
- Fix `@nondiff` AST printing.

Note: 
- Once `SILDifferentiableFunctionType` in swiftlang#23482 lands, `@nondiff` should be nuked from SIL.
- Before merging, pull from the `tensorflow` branch to make sure swiftlang#23887 is merged.

Resolves [TF-421](https://bugs.swift.org/browse/TF-421).
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