Skip to content

[TF] Updates to TensorArrayProtocol derived conformances #24229

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 12 commits into from
Apr 27, 2019
Merged

[TF] Updates to TensorArrayProtocol derived conformances #24229

merged 12 commits into from
Apr 27, 2019

Conversation

eaplatanios
Copy link

@rxwei These updates enable output tensor arrays for raw ops.

Friend PR: tensorflow/swift-bindings#26 .

@eaplatanios
Copy link
Author

Btw, I have verified that this passes all tests on my machine.

Copy link
Contributor

@dan-zheng dan-zheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, awesome!

@eaplatanios
Copy link
Author

I have addressed all the comments in the last commit. :)

Copy link
Contributor

@dan-zheng dan-zheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the best way to test/merge this PR is to merge tensorflow/swift-bindings#26 first, then update checkout for swift-bindings in this PR.

cc @rxwei for your thoughts

@eaplatanios
Copy link
Author

@dan-zheng I just made tensorflow/swift-bindings#26 backwards compatible (it can uses tfop mode when possible and fall back to eager otherwise -- e.g., for output tensor lists). This is done through a new tfop-eager-fallback mode. So, it should be possible to merge it without anything breaking. However, this can also be merged independently as it also doesn't break anything.

I also finally have a working version of a split to TensorFlowCore and TensorFlow that I plan to push soon as part of #24161 . It also allows us to compile swift-apis (which now become part of the TensorFlow package) independently with no errors. :) I'll post more details soon when I push the changes, but in this case swift-bindings becomes part of TensorFlowCore.

@eaplatanios
Copy link
Author

Actually, please don't merge this yet. I'm working on a couple of additions that make the raw ops generation a bit more flexible.

@rxwei
Copy link
Contributor

rxwei commented Apr 24, 2019

The next step is to make sure TensorFlow can get distributed as part of Swift for TensorFlow toolchain builds using build-toolchain-tensorflow. Have you explored whether that's possible?

@dan-zheng
Copy link
Contributor

The next step is to make sure TensorFlow can get distributed as part of Swift for TensorFlow toolchain builds using build-toolchain-tensorflow. Have you explored whether that's possible?

I'm happy to verify build-toolchain-tensorflow works - let me know when it's ready to be tested.

@eaplatanios
Copy link
Author

I just added a _typeList instance property to TensorArrayProtocol. This is useful for raw ops such as this:

/// Creates a dataset that emits each dim-0 slice of `components` once.
@inlinable @inline(__always)
public static func tensorSliceDataset<ToutputTypes: TensorArrayProtocol>(
  components: ToutputTypes,
  outputShapes: [TensorShape?]
) -> VariantHandle {
  let ret: VariantHandle = #tfop("TensorSliceDataset",
    components,
    Toutput_types$dtype: components._typeList,
    output_shapes: outputShapes)
  return ret
}

Not having this instance property would force us to have ToutputTypes: TensorGroup and then use Toutput_types$dtype: ToutputTypes._typeList. This is too constraining and would not work, for example, when building a dataset out of an array of tensors. With this change this works fine.

I have verified that all tests pass on my machine.

I also made the corresponding edits to tensorflow/swift-bindings#26, along with some changes to properly handle input tensor lists when using eager mode.

@eaplatanios
Copy link
Author

All comments have been addressed.

@rxwei
Copy link
Contributor

rxwei commented Apr 26, 2019

@swift-ci please test tensorflow

3 similar comments
@rxwei
Copy link
Contributor

rxwei commented Apr 26, 2019

@swift-ci please test tensorflow

@rxwei
Copy link
Contributor

rxwei commented Apr 26, 2019

@swift-ci please test tensorflow

@rxwei
Copy link
Contributor

rxwei commented Apr 26, 2019

@swift-ci please test tensorflow

@rxwei
Copy link
Contributor

rxwei commented Apr 26, 2019

@swift-ci please test tensorflow Linux

3 similar comments
@rxwei
Copy link
Contributor

rxwei commented Apr 26, 2019

@swift-ci please test tensorflow Linux

@rxwei
Copy link
Contributor

rxwei commented Apr 26, 2019

@swift-ci please test tensorflow Linux

@rxwei
Copy link
Contributor

rxwei commented Apr 26, 2019

@swift-ci please test tensorflow Linux

@eaplatanios
Copy link
Author

@rxwei not sure why this fails on the CI server. All tests pass locally for me.

@eaplatanios
Copy link
Author

@rxwei Could we retry running the tests now that I reverted the swift-bindings changes?

@rxwei
Copy link
Contributor

rxwei commented Apr 27, 2019

@swift-ci please clean test tensorflow

1 similar comment
@rxwei
Copy link
Contributor

rxwei commented Apr 27, 2019

@swift-ci please clean test tensorflow

@eaplatanios
Copy link
Author

@rxwei I merged #24340 here so now all tests should pass (the only failed tests were the GPU strided slice assignment ones.

@rxwei
Copy link
Contributor

rxwei commented Apr 27, 2019

@swift-ci please test tensorflow

3 similar comments
@rxwei
Copy link
Contributor

rxwei commented Apr 27, 2019

@swift-ci please test tensorflow

@rxwei
Copy link
Contributor

rxwei commented Apr 27, 2019

@swift-ci please test tensorflow

@rxwei
Copy link
Contributor

rxwei commented Apr 27, 2019

@swift-ci please test tensorflow

@rxwei
Copy link
Contributor

rxwei commented Apr 27, 2019

@swift-ci please test tensorflow macOS

1 similar comment
@rxwei
Copy link
Contributor

rxwei commented Apr 27, 2019

@swift-ci please test tensorflow macOS

@rxwei rxwei merged commit baee206 into swiftlang:tensorflow Apr 27, 2019
@rxwei rxwei changed the title [TF] Updates to TensorArrayProtocol [TF] Updates to TensorArrayProtocol derived conformances Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants