Skip to content

Commit

Permalink
[xla] Move the shape check in HloReshapeInstruction constructor back to
Browse files Browse the repository at this point in the history
CreateReshape.

PiperOrigin-RevId: 636593668
  • Loading branch information
bixia1 authored and tensorflower-gardener committed May 23, 2024
1 parent b28c56f commit 5f5d143
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 5 additions & 0 deletions third_party/xla/xla/hlo/ir/hlo_instruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,11 @@ HloInstruction::CreateBroadcastSequence(

/* static */ std::unique_ptr<HloInstruction> HloInstruction::CreateReshape(
const Shape& shape, HloInstruction* operand, int64_t inferred_dimension) {
CHECK(operand->shape().is_unbounded_dynamic() ||
ShapeUtil::StaticExtentProduct(shape) ==
ShapeUtil::StaticExtentProduct(operand->shape()))
<< "shape: " << ShapeUtil::HumanString(shape)
<< " operand: " << ShapeUtil::HumanString(operand->shape());
return std::make_unique<HloReshapeInstruction>(shape, operand,
inferred_dimension);
}
Expand Down
5 changes: 0 additions & 5 deletions third_party/xla/xla/hlo/ir/hlo_instructions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1555,11 +1555,6 @@ HloReshapeInstruction::HloReshapeInstruction(const Shape& shape,
int64_t inferred_dimension)
: HloInstruction(HloOpcode::kReshape, shape),
inferred_dimension_(inferred_dimension) {
CHECK(operand->shape().is_unbounded_dynamic() ||
ShapeUtil::StaticExtentProduct(shape) ==
ShapeUtil::StaticExtentProduct(operand->shape()))
<< "shape: " << ShapeUtil::HumanString(shape)
<< " operand: " << ShapeUtil::HumanString(operand->shape());
AppendOperand(operand);
}

Expand Down

0 comments on commit 5f5d143

Please sign in to comment.