Skip to content

Conversation

@dan-zheng
Copy link
Contributor

Previously, LinearMapInfo::addLinearMapToStruct did not remap apply callee
type in derivative context.

Now, remapping is done. Remapping is significant when the derivative has a
more constrained generic signature.

Resolves TF-817.


Reproducer:

extension Array {
  @differentiable(wrt: self where Element : Differentiable)
  public func foo(index: Int) -> Element {
    return self[0]
  }
}
# 'self` wrt parameter type.

# Before: 
(bound_generic_struct_type decl=Swift.(file).Array
  (primary_archetype_type address=0x7fba3e0e1990 name=Element
))

# After:
(bound_generic_struct_type decl=Swift.(file).Array
  (primary_archetype_type address=0x7fba3d95e008 conforms_to=Swift.(file).Differentiable name=τ_0_0

    (nested_type=TangentVector <<unresolved>>)))

This is significant when the derivative has a more constrained generic signature.

Resolves TF-817.
@dan-zheng dan-zheng added the tensorflow This is for "tensorflow" branch PRs. label Oct 9, 2019
@dan-zheng dan-zheng requested a review from rxwei October 9, 2019 19:20
@dan-zheng
Copy link
Contributor Author

Note: the actual fix is relatively small (9fffe89).
I also included NFC gardening (0501f5f) to save time.

@dan-zheng
Copy link
Contributor Author

@swift-ci Please test tensorflow

1 similar comment
@rxwei
Copy link
Contributor

rxwei commented Oct 9, 2019

@swift-ci Please test tensorflow

@dan-zheng dan-zheng merged commit 36676ae into swiftlang:tensorflow Oct 9, 2019
@dan-zheng dan-zheng deleted the TF-817 branch October 9, 2019 21:59
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