From ecccac66d66fc5d2e565becb00ed568c596f3560 Mon Sep 17 00:00:00 2001 From: zhangbo9674 Date: Fri, 13 Oct 2023 07:56:30 +0000 Subject: [PATCH] fix --- .../dialect/operator/ir/control_flow_op.cc | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/paddle/fluid/pir/dialect/operator/ir/control_flow_op.cc b/paddle/fluid/pir/dialect/operator/ir/control_flow_op.cc index cb4e4fed241e9e..3afbec06616620 100644 --- a/paddle/fluid/pir/dialect/operator/ir/control_flow_op.cc +++ b/paddle/fluid/pir/dialect/operator/ir/control_flow_op.cc @@ -119,20 +119,18 @@ void IfOp::VerifySig() { phi::errors::PreconditionNotMet( "The size %d of inputs must be equal to 1.", input_size)); - PADDLE_ENFORCE((*this)->operand_source(0).type().isa(), - phi::errors::PreconditionNotMet( - "Type validation failed for the 1th input, it should be a " - "DenseTensorType.")); - - PADDLE_ENFORCE((*this) - ->operand_source(0) - .type() - .dyn_cast() - .dtype() - .isa(), - phi::errors::PreconditionNotMet( - "Type validation failed for the 1th input, it should be a " - "bool DenseTensorType.")); + if ((*this)->operand_source(0).type().isa()) { + PADDLE_ENFORCE( + (*this) + ->operand_source(0) + .type() + .dyn_cast() + .dtype() + .isa(), + phi::errors::PreconditionNotMet( + "Type validation failed for the 1th input, it should be a " + "bool DenseTensorType.")); + } PADDLE_ENFORCE_EQ((*this)->num_regions(), 2u,