Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

[Tests] Port tensor control flow AD tests #413

Merged
merged 7 commits into from
Nov 14, 2019

Conversation

jon-tow
Copy link
Contributor

@jon-tow jon-tow commented Aug 2, 2019

@rxwei
Copy link
Contributor

rxwei commented Aug 3, 2019

Was it tested locally?

@jon-tow
Copy link
Contributor Author

jon-tow commented Aug 3, 2019

@rxwei Yup. It surely worked on the previous nightly toolchain:
(Swift version 5.1-dev (LLVM 200186e28b, Swift b2720a3460)
I now get the error after updating to the latest nightly.

I'm not sure why testConcatenationPlusPlus() is failing because the return expression in the gradient(at:) call works fine when checked in the REPL with the same tensors. I'll try to see what gradient(at:) is doing with the arguments when I get the chance.

@rxwei
Copy link
Contributor

rxwei commented Aug 4, 2019

It should be a compiler bug that’s introduced recently. The fix is swiftlang/swift#26448 and we need to wait for that to get in.

@rxwei
Copy link
Contributor

rxwei commented Aug 7, 2019

The nightly toolchain used for CI is not up to date because of toolchain build failures. The team is looking into this.

@jon-tow
Copy link
Contributor Author

jon-tow commented Aug 7, 2019

@dan-zheng Would you like me to port over the new tests in swift/test/AutoDiff/control_flow.swift?

@dan-zheng
Copy link
Member

@dan-zheng Would you like me to port over the new tests in swift/test/AutoDiff/control_flow.swift?

The goal is to move all Tensor-specific AD tests to tensorflow/swift-apis. The Tensor control flow AD tests are the last of these.

AutoDiff tests from apple/swift (including swift/test/AutoDiff/control_flow.swift) are intentionally Tensor-independent and should not be ported to tensorflow/swift-apis.

@marcrasi
Copy link
Contributor

marcrasi commented Nov 7, 2019

@jon-tow It looks like tests on this are failing because it's based off an older commit of swift-apis. If you merge master into this, we can probably rerun tests and merge this. Could you try that when you get a chance?

@jon-tow
Copy link
Contributor Author

jon-tow commented Nov 7, 2019

Hey @marcrasi. I merged master into the branch here but I'm getting compiler errors on conditionals that compare Tensor<Float>s with scalar literals. E.g. if x > 0 where x is a Tensor<Float>. This worked just fine a few months ago and any form of casting seems to not resolve the issue.
Any suggestions would be appreciated. Thanks!

@marcrasi
Copy link
Contributor

marcrasi commented Nov 8, 2019

It looks like the comparisons with scalars were deprecated and then removed (#516). The suggestion in the deprecation warning is to use (lhs .> rhs).all(). Does that fix things?

@jon-tow
Copy link
Contributor Author

jon-tow commented Nov 9, 2019

It sure does! Thanks for pointing that out. Invoking all() resolved the issue. :)

@marcrasi
Copy link
Contributor

marcrasi commented Nov 9, 2019

Oh no, a very recent new commit on master made a backwards-incompatible change so CI is still failing. I think if you merge from master again we should be able to get CI passing.

@jon-tow
Copy link
Contributor Author

jon-tow commented Nov 9, 2019

Sure thing! Not a problem. Let me know if you need me to address anything.

@marcrasi marcrasi merged commit 786e774 into tensorflow:master Nov 14, 2019
@jon-tow jon-tow deleted the tests/ad branch November 16, 2019 07:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants