From 7f590dd2288648bff99c015d1d855b6e72a86f74 Mon Sep 17 00:00:00 2001 From: ZPaC Date: Mon, 6 Feb 2023 16:54:56 +0800 Subject: [PATCH] Check abs input number --- mindspore/core/ops/abs.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mindspore/core/ops/abs.cc b/mindspore/core/ops/abs.cc index 7204c2f73a5..b0da76c33c1 100644 --- a/mindspore/core/ops/abs.cc +++ b/mindspore/core/ops/abs.cc @@ -41,6 +41,10 @@ class AbsInfer : public abstract::OpInferBase { } TypePtr InferType(const PrimitivePtr &prim, const std::vector &input_args) const override { + MS_EXCEPTION_IF_NULL(prim); + auto prim_name = prim->name(); + const int64_t input_num = 1; + CheckAndConvertUtils::CheckInteger("input number", SizeToLong(input_args.size()), kEqual, input_num, prim_name); auto x_type = input_args[0]->BuildType(); (void)CheckAndConvertUtils::CheckTensorTypeValid("x", x_type, common_valid_types, prim->name()); return x_type;