Flatten Computation classes#5230
Merged
Merged
Conversation
2f1c52f to
20d4061
Compare
Computation classesComputation classes
Collaborator
|
Let me take a look now.. |
JackCaoG
reviewed
Sep 15, 2023
Comment on lines
-83
to
-85
| : computation_(std::move(computation)), devices_(std::move(devices)) { | ||
| program_shape_ = ConsumeValue(computation_.GetProgramShape()); | ||
| } |
Collaborator
There was a problem hiding this comment.
any reason program_shape_ is only being inited on one of the constructors?
Collaborator
Author
There was a problem hiding this comment.
All of the other constructors delegate to the one that sets program_shape_ and hash_.
https://secure.wikimedia.org/wikipedia/en/wiki/C++11#Object_construction_improvement
JackCaoG
reviewed
Sep 15, 2023
| } | ||
|
|
||
| const std::vector<std::string>& parameter_names() const override { | ||
| return program_shape().parameter_names(); |
Collaborator
There was a problem hiding this comment.
seems like we can't alwasy reply on that program_shape exists
Collaborator
Author
There was a problem hiding this comment.
All of the constructors initialize program shape, as long as its available from the XlaComputation. See my other comment.
JackCaoG
reviewed
Sep 15, 2023
JackCaoG
approved these changes
Sep 15, 2023
alanwaketan
approved these changes
Sep 15, 2023
2ab0297 to
661896e
Compare
zpcore
pushed a commit
that referenced
this pull request
Sep 28, 2023
* Flatten `Computation` classes * Remove compat_logging hack * Remove wrap/unwrap * Remove alias * Remove unused fields * Don't set hash when device is passed? * Fix test build issue * Move hash initialization * formatting * Consolidate constructors and add comments back * formatting * Update comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
torch_xla::Computationclass now that we can mix PyTorch and OpenXLA in the same build.computation.h(please make sure my understanding is correct).To be honest, I still don't think the difference between the three uses of Computation is clear, so I'll likely follow up with more refactoring to make the differences explicit.