diff --git a/lite/operators/slice_op.cc b/lite/operators/slice_op.cc index c18fc989411b8e074f562af0f1685810872151c6..9757015848e542b7c96c24fc8c5b3b0313d73eaa 100644 --- a/lite/operators/slice_op.cc +++ b/lite/operators/slice_op.cc @@ -43,7 +43,7 @@ bool SliceOp::InferShapeImpl() const { CHECK_LT(param_.axes[i], in_dims.size()) << "The index of dimension in " "axes must be less than the " "size of input shape."; - if (param_.infer_flags[i] == -1) { + if (param_.infer_flags.size() > i && param_.infer_flags[i] == -1) { out_dims[axes[i]] = -1; } else { // infer out_dim shape