diff --git a/ge/offline/single_op_parser.cc b/ge/offline/single_op_parser.cc index 93fe503e..d6b62c16 100644 --- a/ge/offline/single_op_parser.cc +++ b/ge/offline/single_op_parser.cc @@ -210,7 +210,7 @@ void from_json(const Json &j, SingleOpTensorDesc &desc) { desc.dynamic_input_name = dynamic_input_name->get(); } if (!is_tensor_valid) { - ge::AttrUtils::SetBool(&desc, kSingleOpTensorDescValid, is_tensor_valid); + desc.SetValidFlag(is_tensor_valid); } } @@ -315,7 +315,7 @@ bool SingleOpParser::Validate(const SingleOpDesc &op_desc) { int index = 0; for (auto &tensor_desc : op_desc.input_desc) { - if (ge::AttrUtils::GetBool(&tensor_desc)) { + if (!tensor_desc.GetValidFlag()) { ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "type", "index"}, {"intput", "datatype or format", std::to_string(index)}); GELOGE(PARAM_INVALID, "Input's dataType or format is invalid when the index is %d", index); @@ -333,7 +333,7 @@ bool SingleOpParser::Validate(const SingleOpDesc &op_desc) { index = 0; for (auto &tensor_desc : op_desc.output_desc) { - if (ge::AttrUtils::GetBool(&tensor_desc)) { + if (!tensor_desc.GetValidFlag()) { ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "type", "index"}, {"output", "datatype", std::to_string(index)}); GELOGE(PARAM_INVALID, "Output's dataType is invalid when the index is %d", index); diff --git a/ge/offline/single_op_parser.h b/ge/offline/single_op_parser.h index 64310030..a728b5b9 100644 --- a/ge/offline/single_op_parser.h +++ b/ge/offline/single_op_parser.h @@ -23,12 +23,15 @@ #include "ge/ge_api_error_codes.h" #include "graph/types.h" -#include "graph/detail/attributes_holder.h" #include "graph/ge_attr_value.h" #include "graph/op_desc.h" namespace ge { -struct SingleOpTensorDesc: public AttrHolder { +struct SingleOpTensorDesc { +public: + bool GetValidFlag() { return is_valid_; } + void SetValidFlag(bool is_valid) { is_valid_ = is_valid; } +public: std::string name; std::vector dims; std::vector ori_dims; @@ -37,6 +40,8 @@ struct SingleOpTensorDesc: public AttrHolder { ge::Format ori_format = ge::FORMAT_RESERVED; ge::DataType type = ge::DT_UNDEFINED; std::string dynamic_input_name; +private: + bool is_valid_ = true; }; struct SingleOpAttr {