diff --git a/paddle/fluid/operators/conv_op.cc b/paddle/fluid/operators/conv_op.cc index 5ce8422c9ad45662e8bc804b62ab1741e252b6d4..4cd20e6ecd5e67288bc45b87ef9afa8adb02c7a1 100644 --- a/paddle/fluid/operators/conv_op.cc +++ b/paddle/fluid/operators/conv_op.cc @@ -116,10 +116,13 @@ std::vector ConvOp::ComputeOutputShape( "the output channels is %d, the filter's shape is [%s], " "the groups is %d.", filter_dims[0], filter_dims, groups)); - PADDLE_ENFORCE_GT( - filter_dims[0], 0, - platform::errors::InvalidArgument( - "the size of filter at axis 0 should be greater than 0")); + + if (ctx->IsRuntime()) { + PADDLE_ENFORCE_GT( + filter_dims[0], 0, + platform::errors::InvalidArgument( + "the size of filter at axis 0 should be greater than 0")); + } framework::DDim in_data_dims; if (channel_last) {