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

Re-implement tensor shape/rank operators using TFE runtime APIs. #141

Merged
merged 1 commit into from
May 31, 2019

Conversation

eaplatanios
Copy link
Contributor

@rxwei Ported from swiftlang/swift#24949.

Gives me about 98% speedup for Tensor.rank and 85% speedup for Tensor.shape (for a 2x3 tensor) on a MacBook Pro and all tests pass.

@rxwei
Copy link
Contributor

rxwei commented May 30, 2019

Thanks Anthony! In my earlier experiment it crashed on macOS only. Glad to hear you didn't have this issue, but I'll build and verify this locally.

@bgogul
Copy link
Contributor

bgogul commented May 30, 2019

Nice @eaplatanios ! One thing to keep in mind is that using eager API directly will affect the performance of Lazy Tensor as it triggers materialization of symbolic tensors and break traces into smaller ones.

@rxwei
Copy link
Contributor

rxwei commented May 30, 2019

Nice @eaplatanios ! One thing to keep in mind is that using eager API directly will affect the performance of Lazy Tensor as it triggers materialization of symbolic tensors and break traces into smaller ones.

Would it be possible for you to profile your lazy tensor implementation against changes made by this PR?

@eaplatanios
Copy link
Contributor Author

@bgogul @rxwei I think that's fine because if you want to use the lazy tensor implementation you can still use rankTensor and shapeTensor.

@rxwei
Copy link
Contributor

rxwei commented May 30, 2019

@bgogul @rxwei I think that's fine because if you want to use the lazy tensor implementation you can still use rankTensor and shapeTensor.

Ah yep, totally.

@eaplatanios
Copy link
Contributor Author

I believe that to test this and all follow-up PRs we need to update the toolchain used by the CI server. Otherwise, we'll be getting failures related to TensorGroup.

@rxwei
Copy link
Contributor

rxwei commented May 31, 2019

A new CI toolchain will be ready in an hour.

@rxwei rxwei added the enhancement New feature or request label May 31, 2019
@rxwei rxwei self-assigned this May 31, 2019
@rxwei rxwei removed the kokoro:run label May 31, 2019
@rxwei
Copy link
Contributor

rxwei commented May 31, 2019

All tests passed. Thank you!

@rxwei rxwei merged commit 89b8548 into tensorflow:master May 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants