!48460 Check abs input number

Merge pull request !48460 from ZPaC/check-abs-input-num
This commit is contained in:
i-robot 2023-02-07 01:38:08 +00:00 committed by Gitee
commit d94921848c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 4 additions and 0 deletions

View File

@ -41,6 +41,10 @@ class AbsInfer : public abstract::OpInferBase {
}
TypePtr InferType(const PrimitivePtr &prim, const std::vector<AbstractBasePtr> &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;