Add an equality node - #4079
Merged
Merged
Conversation
JackCaoG
reviewed
Oct 10, 2022
| const torch::lazy::DimensionNode* dim_node_1 = DimCast(operand(1)); | ||
| XLA_CHECK(dim_node_0); | ||
| XLA_CHECK(dim_node_1); | ||
| return dim_node_0->getDynamicValue() == dim_node_1->getDynamicValue() ? 1 : 0; |
Collaborator
There was a problem hiding this comment.
would return dim_node_0->getDynamicValue() == dim_node_1->getDynamicValue() caused a weird cast issue?
JackCaoG
reviewed
Oct 10, 2022
Collaborator
|
Can you rebase and kick off CI again? |
vanbasten23
reviewed
Oct 11, 2022
| SizeEq(torch::lazy::Value a, torch::lazy::Value b); | ||
| int64_t getDynamicValue() const override; | ||
| int64_t getStaticValue() { | ||
| TORCH_CHECK(false, "Comparison operators should be using getDynamicValue"); |
Collaborator
There was a problem hiding this comment.
I guess the use case for the SizeEq node is that users does a tensor1.shape[0] == tensor2.shape[0] or tensor1.shape[0] == tensor1.shape[1] or something similar, right?
Collaborator
There was a problem hiding this comment.
any two tensor shapes can be compared.
vanbasten23
reviewed
Oct 11, 2022
vanbasten23
reviewed
Oct 11, 2022
| return this->data()->ir_value->op() != xla_device_data; | ||
| } | ||
|
|
||
| c10::SymIntNode XLASymIntNodeImpl::eq(const c10::SymIntNode& other) { |
Collaborator
There was a problem hiding this comment.
Do you need to add a test?
miladm
reviewed
Oct 11, 2022
miladm
left a comment
Collaborator
There was a problem hiding this comment.
Awesome. Took an initial pass. Reran the build.
miladm
reviewed
Oct 13, 2022
| c10::SymIntNode XLASymIntNodeImpl::eq(const c10::SymIntNode& other) { | ||
| auto pother = dynamic_cast<XLASymIntNodeImpl*>(other.get()); | ||
| auto neq = torch::lazy::MakeNode<SizeEq>(node(), pother->node()); | ||
| return c10::make_intrusiveXLASymIntNodeImpl>(neq); |
Collaborator
There was a problem hiding this comment.
make_intrusive<XLASymIntNodeImpl>
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.
No description provided.