Change cast to dyn_cast in hlo::ReshapeOp's verification.

With cast, a failing verification results in an assertion error rather than returning a failing status.

PiperOrigin-RevId: 322317937
This commit is contained in:
Tres Popp 2020-07-21 09:06:21 +00:00 committed by Mehdi Amini
parent c23ad602c8
commit 63d62b7952
1 changed files with 1 additions and 1 deletions

View File

@ -1468,7 +1468,7 @@ static LogicalResult Verify(PadOp op) {
static LogicalResult Verify(ReshapeOp op) { static LogicalResult Verify(ReshapeOp op) {
// If the operand type is dynamically shaped there is nothing to verify. // If the operand type is dynamically shaped there is nothing to verify.
auto operand_ty = op.operand().getType().cast<RankedTensorType>(); auto operand_ty = op.operand().getType().dyn_cast<RankedTensorType>();
if (!operand_ty || !operand_ty.hasStaticShape()) return success(); if (!operand_ty || !operand_ty.hasStaticShape()) return success();
// If the operand type is statically shaped (not required) the number of // If the operand type is statically shaped (not required) the number of