| @@ -1 +1 @@ | |||||
| Subproject commit 326ecbb2b4837699aa674cc30e9b9956e4fd364d | |||||
| Subproject commit 0b6395643fd358080d8d2a80868d09154d47b7e9 | |||||
| @@ -78,6 +78,10 @@ using std::ifstream; | |||||
| } \ | } \ | ||||
| } while (0) | } while (0) | ||||
| namespace { | |||||
| const size_t kMaxErrStrLen = 128U; | |||||
| } // namespace | |||||
| namespace ge { | namespace ge { | ||||
| graphStatus aclgrphParseCaffe(const char *model_file, const char *weights_file, ge::Graph &graph) { | graphStatus aclgrphParseCaffe(const char *model_file, const char *weights_file, ge::Graph &graph) { | ||||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | ||||
| @@ -247,7 +251,9 @@ Status CheckPathValid(const char *model_path, const string &custom_proto, string | |||||
| string &custom_proto_name) { | string &custom_proto_name) { | ||||
| string path_model = ge::parser::RealPath(model_path); | string path_model = ge::parser::RealPath(model_path); | ||||
| if (path_model.empty()) { | if (path_model.empty()) { | ||||
| ErrorManager::GetInstance().ATCReportErrMessage("E19000", {"path", "errmsg"}, {model_path, strerror(errno)}); | |||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| ErrorManager::GetInstance().ATCReportErrMessage("E19000", {"path", "errmsg"}, {model_path, err_msg}); | |||||
| GELOGE(FAILED, "[Check][Param]ModelPath %s is Invalid path of model", model_path); | GELOGE(FAILED, "[Check][Param]ModelPath %s is Invalid path of model", model_path); | ||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| @@ -447,24 +453,30 @@ Status CaffeModelParser::CustomProtoParse(const char *model_path, const string & | |||||
| Status CaffeModelParser::ReadModelWithoutWarning(const char *model_path, google::protobuf::Message *message) { | Status CaffeModelParser::ReadModelWithoutWarning(const char *model_path, google::protobuf::Message *message) { | ||||
| int32_t copy_fd = mmDup(STDERR_FILENO); | int32_t copy_fd = mmDup(STDERR_FILENO); | ||||
| if (copy_fd < 0) { | if (copy_fd < 0) { | ||||
| REPORT_CALL_ERROR("E19999", "Duplicate to file STDERR_FILENO failed, errmsg:%s", strerror(errno)); | |||||
| GELOGE(FAILED, "[Invoke][Dup] failed:%d, reason:%s", copy_fd, strerror(errno)); | |||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| REPORT_CALL_ERROR("E19999", "Duplicate to file STDERR_FILENO failed, errmsg:%s", err_msg); | |||||
| GELOGE(FAILED, "[Invoke][Dup] failed:%d, reason:%s", copy_fd, err_msg); | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| int32_t fd = mmOpen(kDevNull, M_RDWR); | int32_t fd = mmOpen(kDevNull, M_RDWR); | ||||
| if (fd < 0) { | if (fd < 0) { | ||||
| (void)mmClose(copy_fd); | (void)mmClose(copy_fd); | ||||
| ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, {kDevNull, strerror(errno)}); | |||||
| GELOGE(FAILED, "[Open][File] %s failed. reason:%s", kDevNull, strerror(errno)); | |||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, {kDevNull, err_msg}); | |||||
| GELOGE(FAILED, "[Open][File] %s failed. reason:%s", kDevNull, err_msg); | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| if (mmDup2(fd, STDERR_FILENO) < 0) { | if (mmDup2(fd, STDERR_FILENO) < 0) { | ||||
| (void)mmClose(fd); | (void)mmClose(fd); | ||||
| (void)mmClose(copy_fd); | (void)mmClose(copy_fd); | ||||
| REPORT_CALL_ERROR("E19999", "Duplicate to file STDERR_FILENO failed, errmsg:%s", strerror(errno)); | |||||
| GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed. reason:%s", strerror(errno)); | |||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| REPORT_CALL_ERROR("E19999", "Duplicate to file STDERR_FILENO failed, errmsg:%s", err_msg); | |||||
| GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed. reason:%s", err_msg); | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| @@ -478,8 +490,10 @@ Status CaffeModelParser::ReadModelWithoutWarning(const char *model_path, google: | |||||
| if (mmDup2(copy_fd, STDERR_FILENO) < 0) { | if (mmDup2(copy_fd, STDERR_FILENO) < 0) { | ||||
| (void)mmClose(fd); | (void)mmClose(fd); | ||||
| (void)mmClose(copy_fd); | (void)mmClose(copy_fd); | ||||
| REPORT_CALL_ERROR("E19999", "Duplicate to file STDERR_FILENO failed, errmsg:%s", strerror(errno)); | |||||
| GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed. reason:%s", strerror(errno)); | |||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| REPORT_CALL_ERROR("E19999", "Duplicate to file STDERR_FILENO failed, errmsg:%s", err_msg); | |||||
| GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed. reason:%s", err_msg); | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| (void)mmClose(fd); | (void)mmClose(fd); | ||||
| @@ -46,6 +46,7 @@ using google::protobuf::io::ZeroCopyInputStream; | |||||
| using namespace ge::parser; | using namespace ge::parser; | ||||
| namespace { | namespace { | ||||
| const size_t kMaxErrStrLen = 128U; | |||||
| const std::string kGraphDefaultName = "domi_default"; | const std::string kGraphDefaultName = "domi_default"; | ||||
| /// The maximum length of the file. | /// The maximum length of the file. | ||||
| /// Based on the security coding specification and the current actual (protobuf) model size, it is determined as 2G-1 | /// Based on the security coding specification and the current actual (protobuf) model size, it is determined as 2G-1 | ||||
| @@ -692,16 +693,17 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY long GetFileLength(const std::s | |||||
| return -1, "[Check][Param] input_file path is null."); | return -1, "[Check][Param] input_file path is null."); | ||||
| std::string real_path = RealPath(input_file.c_str()); | std::string real_path = RealPath(input_file.c_str()); | ||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(real_path.empty(), | GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(real_path.empty(), | ||||
| REPORT_INPUT_ERROR("E19000", std::vector<std::string>({"path", "errmsg"}), | REPORT_INPUT_ERROR("E19000", std::vector<std::string>({"path", "errmsg"}), | ||||
| std::vector<std::string>({real_path, strerror(errno)})); | |||||
| std::vector<std::string>({real_path, err_msg})); | |||||
| return -1, "[Get][Path] input_file path '%s' not valid", input_file.c_str()); | return -1, "[Get][Path] input_file path '%s' not valid", input_file.c_str()); | ||||
| unsigned long long file_length = 0; | unsigned long long file_length = 0; | ||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(mmGetFileSize(input_file.c_str(), &file_length) != EN_OK, | GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(mmGetFileSize(input_file.c_str(), &file_length) != EN_OK, | ||||
| ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, | ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, | ||||
| {input_file, strerror(errno)}); | |||||
| return -1, "[Open][File] [%s] failed. %s", input_file.c_str(), strerror(errno)); | |||||
| {input_file, err_msg}); | |||||
| return -1, "[Open][File] [%s] failed. %s", input_file.c_str(), err_msg); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file_length == 0 || file_length > kMaxFileSizeLimit), | GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file_length == 0 || file_length > kMaxFileSizeLimit), | ||||
| REPORT_INPUT_ERROR( | REPORT_INPUT_ERROR( | ||||
| @@ -829,11 +831,13 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromText(const ch | |||||
| "[Check][Param]incorrect parameter. nullptr == file || nullptr == message"); | "[Check][Param]incorrect parameter. nullptr == file || nullptr == message"); | ||||
| std::string real_path = RealPath(file); | std::string real_path = RealPath(file); | ||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(real_path.empty(), | GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(real_path.empty(), | ||||
| ErrorManager::GetInstance().ATCReportErrMessage("E19000", {"path", "errmsg"}, | ErrorManager::GetInstance().ATCReportErrMessage("E19000", {"path", "errmsg"}, | ||||
| {file, strerror(errno)}); | |||||
| {file, err_msg}); | |||||
| return false, "[Check][Param]Path[%s]'s realpath is empty, errmsg[%s]", file, | return false, "[Check][Param]Path[%s]'s realpath is empty, errmsg[%s]", file, | ||||
| strerror(errno)); | |||||
| err_msg); | |||||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(GetFileLength(real_path) == -1, return false, "[Check][Param] file size not valid."); | GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(GetFileLength(real_path) == -1, return false, "[Check][Param] file size not valid."); | ||||
| @@ -25,6 +25,7 @@ | |||||
| #include "mmpa/mmpa_api.h" | #include "mmpa/mmpa_api.h" | ||||
| namespace { | namespace { | ||||
| const size_t kMaxErrStrLen = 128U; | |||||
| const int kFileOpSuccess = 0; | const int kFileOpSuccess = 0; | ||||
| } // namespace | } // namespace | ||||
| @@ -65,8 +66,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFi | |||||
| mode_t mode = S_IRUSR | S_IWUSR; | mode_t mode = S_IRUSR | S_IWUSR; | ||||
| int32_t fd = mmOpen2(real_path, O_RDWR | O_CREAT | O_TRUNC, mode); | int32_t fd = mmOpen2(real_path, O_RDWR | O_CREAT | O_TRUNC, mode); | ||||
| if (fd == EN_ERROR || fd == EN_INVALID_PARAM) { | if (fd == EN_ERROR || fd == EN_INVALID_PARAM) { | ||||
| ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, {file_path, strerror(errno)}); | |||||
| GELOGE(FAILED, "[Open][File] [%s] failed. %s", file_path, strerror(errno)); | |||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, {file_path, err_msg}); | |||||
| GELOGE(FAILED, "[Open][File] [%s] failed. %s", file_path, err_msg); | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| const char *model_char = model_str.c_str(); | const char *model_char = model_str.c_str(); | ||||
| @@ -74,16 +77,20 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFi | |||||
| // Write data to file | // Write data to file | ||||
| mmSsize_t mmpa_ret = mmWrite(fd, const_cast<void *>((const void *)model_char), len); | mmSsize_t mmpa_ret = mmWrite(fd, const_cast<void *>((const void *)model_char), len); | ||||
| if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { | if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { | ||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
| "E19004", {"file", "errmsg"}, {file_path, strerror(errno)}); | |||||
| "E19004", {"file", "errmsg"}, {file_path, err_msg}); | |||||
| // Need to both print the error info of mmWrite and mmClose, so return ret after mmClose | // Need to both print the error info of mmWrite and mmClose, so return ret after mmClose | ||||
| GELOGE(FAILED, "[WriteTo][File] %s failed. errno = %ld, %s", file_path, mmpa_ret, strerror(errno)); | |||||
| GELOGE(FAILED, "[WriteTo][File] %s failed. errno = %ld, %s", file_path, mmpa_ret, err_msg); | |||||
| ret = FAILED; | ret = FAILED; | ||||
| } | } | ||||
| // Close file | // Close file | ||||
| if (mmClose(fd) != EN_OK) { | if (mmClose(fd) != EN_OK) { | ||||
| REPORT_INNER_ERROR("E19999", "close file:%s failed. errmsg:%s", file_path, strerror(errno)); | |||||
| GELOGE(FAILED, "[Close][File] %s failed. errmsg:%s", file_path, strerror(errno)); | |||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| REPORT_INNER_ERROR("E19999", "close file:%s failed. errmsg:%s", file_path, err_msg); | |||||
| GELOGE(FAILED, "[Close][File] %s failed. errmsg:%s", file_path, err_msg); | |||||
| ret = FAILED; | ret = FAILED; | ||||
| } | } | ||||
| return ret; | return ret; | ||||
| @@ -137,11 +144,13 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int ModelSaver::CreateDirectory | |||||
| int32_t ret = mmMkdir(tmp_dir_path, S_IRUSR | S_IWUSR | S_IXUSR); // 700 | int32_t ret = mmMkdir(tmp_dir_path, S_IRUSR | S_IWUSR | S_IXUSR); // 700 | ||||
| if (ret != 0) { | if (ret != 0) { | ||||
| if (errno != EEXIST) { | if (errno != EEXIST) { | ||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| REPORT_CALL_ERROR("E19999", | REPORT_CALL_ERROR("E19999", | ||||
| "Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | "Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | ||||
| directory_path.c_str(), strerror(errno)); | |||||
| directory_path.c_str(), err_msg); | |||||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | ||||
| directory_path.c_str(), strerror(errno)); | |||||
| directory_path.c_str(), err_msg); | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| } | } | ||||
| @@ -151,11 +160,13 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int ModelSaver::CreateDirectory | |||||
| int32_t ret = mmMkdir(const_cast<char *>(directory_path.c_str()), S_IRUSR | S_IWUSR | S_IXUSR); // 700 | int32_t ret = mmMkdir(const_cast<char *>(directory_path.c_str()), S_IRUSR | S_IWUSR | S_IXUSR); // 700 | ||||
| if (ret != 0) { | if (ret != 0) { | ||||
| if (errno != EEXIST) { | if (errno != EEXIST) { | ||||
| char_t err_buf[kMaxErrStrLen + 1U] = {}; | |||||
| const auto err_msg = mmGetErrorFormatMessage(mmGetErrorCode(), &err_buf[0], kMaxErrStrLen); | |||||
| REPORT_CALL_ERROR("E19999", | REPORT_CALL_ERROR("E19999", | ||||
| "Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | "Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | ||||
| directory_path.c_str(), strerror(errno)); | |||||
| directory_path.c_str(), err_msg); | |||||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | ||||
| directory_path.c_str(), strerror(errno)); | |||||
| directory_path.c_str(), err_msg); | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| } | } | ||||
| @@ -20,6 +20,8 @@ | |||||
| #include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
| #include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
| #include "register/op_registry.h" | #include "register/op_registry.h" | ||||
| #include "parser/common/parser_utils.h" | |||||
| #include "graph/def_types.h" | |||||
| using domi::ONNX; | using domi::ONNX; | ||||
| using domi::ParseParamByOpFunc; | using domi::ParseParamByOpFunc; | ||||
| @@ -28,7 +30,7 @@ using domi::ParseParamFunc; | |||||
| namespace ge { | namespace ge { | ||||
| Status OnnxCustomParserAdapter::ParseParams(const Message *op_src, ge::Operator &op_dest) { | Status OnnxCustomParserAdapter::ParseParams(const Message *op_src, ge::Operator &op_dest) { | ||||
| GE_CHECK_NOTNULL(op_src); | GE_CHECK_NOTNULL(op_src); | ||||
| const ge::onnx::NodeProto *node_src = reinterpret_cast<const ge::onnx::NodeProto *>(op_src); | |||||
| const ge::onnx::NodeProto *node_src = PtrToPtr<const Message, const ge::onnx::NodeProto>(op_src); | |||||
| GE_CHECK_NOTNULL(node_src); | GE_CHECK_NOTNULL(node_src); | ||||
| GELOGI("Onnx op node name = %s, op type= %s, parse params.", node_src->name().c_str(), node_src->op_type().c_str()); | GELOGI("Onnx op node name = %s, op type= %s, parse params.", node_src->name().c_str(), node_src->op_type().c_str()); | ||||
| @@ -18,6 +18,7 @@ | |||||
| #include <unordered_map> | #include <unordered_map> | ||||
| #include "common/util.h" | #include "common/util.h" | ||||
| #include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
| #include "graph/def_types.h" | |||||
| #include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
| #include "framework/omg/parser/parser_inner_ctx.h" | #include "framework/omg/parser/parser_inner_ctx.h" | ||||
| #include "parser/onnx/onnx_util.h" | #include "parser/onnx/onnx_util.h" | ||||
| @@ -28,7 +29,7 @@ using namespace ge::parser; | |||||
| namespace ge { | namespace ge { | ||||
| Status OnnxDataParser::ParseParams(const Message *op_src, ge::Operator &op_def) { | Status OnnxDataParser::ParseParams(const Message *op_src, ge::Operator &op_def) { | ||||
| GE_CHECK_NOTNULL(op_src); | GE_CHECK_NOTNULL(op_src); | ||||
| const ge::onnx::NodeProto *node_src = reinterpret_cast<const ge::onnx::NodeProto *>(op_src); | |||||
| const ge::onnx::NodeProto *node_src = PtrToPtr<const Message, const ge::onnx::NodeProto>(op_src); | |||||
| GE_CHECK_NOTNULL(node_src); | GE_CHECK_NOTNULL(node_src); | ||||
| GELOGD("Onnx op node name = %s, op type= %s, parse params", node_src->name().c_str(), node_src->op_type().c_str()); | GELOGD("Onnx op node name = %s, op type= %s, parse params", node_src->name().c_str(), node_src->op_type().c_str()); | ||||
| if (ParseInputFromModel(op_src, op_def) != SUCCESS) { | if (ParseInputFromModel(op_src, op_def) != SUCCESS) { | ||||
| @@ -72,7 +73,7 @@ int64_t OnnxDataParser::ParseInputTensor(const ge::onnx::AttributeProto &attribu | |||||
| Status OnnxDataParser::ParseInputFromModel(const Message *op_src, ge::Operator &op_def) { | Status OnnxDataParser::ParseInputFromModel(const Message *op_src, ge::Operator &op_def) { | ||||
| GE_CHECK_NOTNULL(op_src); | GE_CHECK_NOTNULL(op_src); | ||||
| const ge::onnx::NodeProto *node = reinterpret_cast<const ge::onnx::NodeProto *>(op_src); | |||||
| const ge::onnx::NodeProto *node = PtrToPtr<const Message, const ge::onnx::NodeProto>(op_src); | |||||
| GE_CHECK_NOTNULL(node); | GE_CHECK_NOTNULL(node); | ||||
| // Get attr t:'input_tensor' form NodeProto | // Get attr t:'input_tensor' form NodeProto | ||||
| @@ -19,6 +19,7 @@ | |||||
| #include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
| #include "common/util.h" | #include "common/util.h" | ||||
| #include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
| #include "graph/def_types.h" | |||||
| #include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
| #include "register/op_registry.h" | #include "register/op_registry.h" | ||||
| #include "register/register.h" | #include "register/register.h" | ||||
| @@ -42,7 +43,7 @@ Status TensorFlowAutoMappingParserAdapter::ParseParams(const Message *op_src, ge | |||||
| GELOGE(PARAM_INVALID, "Op src is null"); | GELOGE(PARAM_INVALID, "Op src is null"); | ||||
| return PARAM_INVALID; | return PARAM_INVALID; | ||||
| } | } | ||||
| const NodeDef *node = reinterpret_cast<const NodeDef *>(op_src); | |||||
| const NodeDef *node = PtrToPtr<const Message, const NodeDef>(op_src); | |||||
| GELOGD("TF op node name = %s, op type= %s, parse params", node->name().c_str(), node->op().c_str()); | GELOGD("TF op node name = %s, op type= %s, parse params", node->name().c_str(), node->op().c_str()); | ||||
| if (op_dest == nullptr) { | if (op_dest == nullptr) { | ||||
| REPORT_INNER_ERROR("E19999", "Param op_dest is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param op_dest is nullptr, check invalid"); | ||||
| @@ -31,7 +31,7 @@ Status TensorFlowEnterParser::ParseParams(const Message *op_src, ge::OpDescPtr & | |||||
| GE_CHECK_NOTNULL(op_desc); | GE_CHECK_NOTNULL(op_desc); | ||||
| const std::string name = op_desc->GetName(); | const std::string name = op_desc->GetName(); | ||||
| const NodeDef *node = reinterpret_cast<const NodeDef *>(op_src); | |||||
| const NodeDef *node = PtrToPtr<const Message, const NodeDef>(op_src); | |||||
| domi::tensorflow::AttrValue str_attr; | domi::tensorflow::AttrValue str_attr; | ||||
| if (!TensorFlowUtil::FindAttrValue(node, ENTER_ATTR_FRAME_NAME, str_attr)) { | if (!TensorFlowUtil::FindAttrValue(node, ENTER_ATTR_FRAME_NAME, str_attr)) { | ||||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | ||||
| @@ -21,6 +21,7 @@ | |||||
| #include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
| #include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
| #include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
| #include "graph/def_types.h" | |||||
| using domi::TENSORFLOW; | using domi::TENSORFLOW; | ||||
| using ge::parser::MERGE; | using ge::parser::MERGE; | ||||
| @@ -30,7 +31,7 @@ Status TensorFlowMergeParser::ParseParams(const Message *op_src, ge::OpDescPtr & | |||||
| GE_CHECK_NOTNULL(op_src); | GE_CHECK_NOTNULL(op_src); | ||||
| GE_CHECK_NOTNULL(op_desc); | GE_CHECK_NOTNULL(op_desc); | ||||
| const NodeDef *node = reinterpret_cast<const NodeDef *>(op_src); | |||||
| const NodeDef *node = PtrToPtr<const Message, const NodeDef>(op_src); | |||||
| domi::tensorflow::AttrValue attr_num; | domi::tensorflow::AttrValue attr_num; | ||||
| if (!(TensorFlowUtil::FindAttrValue(node, ATTR_NAME_N, attr_num))) { | if (!(TensorFlowUtil::FindAttrValue(node, ATTR_NAME_N, attr_num))) { | ||||
| GELOGW("In NodeDef %s dynamic attr [%s] is not exist.", op_desc->GetName().c_str(), ATTR_NAME_N.c_str()); | GELOGW("In NodeDef %s dynamic attr [%s] is not exist.", op_desc->GetName().c_str(), ATTR_NAME_N.c_str()); | ||||
| @@ -42,10 +42,9 @@ Status TensorFlowReshapeParser::ParseDesc(const domi::tensorflow::AttrValue &att | |||||
| ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | ||||
| return PARAM_INVALID); | return PARAM_INVALID); | ||||
| // calculate size | // calculate size | ||||
| int64_t tmp_dim = 0; | |||||
| int64_t real_size = 1; | int64_t real_size = 1; | ||||
| for (uint32_t j = 0; j < ge_desc.GetShape().GetDimNum(); ++j) { | for (uint32_t j = 0; j < ge_desc.GetShape().GetDimNum(); ++j) { | ||||
| tmp_dim = ge_desc.GetShape().GetDim(j); | |||||
| int64_t tmp_dim = ge_desc.GetShape().GetDim(j); | |||||
| GE_IF_BOOL_EXEC(tmp_dim < 0, real_size = tmp_dim * (-1) * real_size; continue;); | GE_IF_BOOL_EXEC(tmp_dim < 0, real_size = tmp_dim * (-1) * real_size; continue;); | ||||
| real_size *= tmp_dim; | real_size *= tmp_dim; | ||||
| } | } | ||||
| @@ -47,9 +47,8 @@ Status TensorFlowSqueezeParser::ParseDesc(const domi::tensorflow::AttrValue &att | |||||
| return domi::PARAM_INVALID); | return domi::PARAM_INVALID); | ||||
| // calculate size | // calculate size | ||||
| int64_t real_size = 1; | int64_t real_size = 1; | ||||
| int64_t tmp_dim = 0; | |||||
| for (uint32_t j = 0; j < ge_desc.GetShape().GetDimNum(); ++j) { | for (uint32_t j = 0; j < ge_desc.GetShape().GetDimNum(); ++j) { | ||||
| tmp_dim = ge_desc.GetShape().GetDim(j); | |||||
| int64_t tmp_dim = ge_desc.GetShape().GetDim(j); | |||||
| GE_IF_BOOL_EXEC(tmp_dim < 0, real_size = tmp_dim * (-1) * real_size; continue;); | GE_IF_BOOL_EXEC(tmp_dim < 0, real_size = tmp_dim * (-1) * real_size; continue;); | ||||
| PARSER_INT64_MULCHECK(real_size, tmp_dim); | PARSER_INT64_MULCHECK(real_size, tmp_dim); | ||||
| real_size *= tmp_dim; | real_size *= tmp_dim; | ||||
| @@ -271,9 +271,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY domi::Status TensorFlowUtil::Tr | |||||
| GE_CHK_BOOL_RET_STATUS(ge::TypeUtils::GetDataTypeLength(data_type, size_type), PARAM_INVALID, | GE_CHK_BOOL_RET_STATUS(ge::TypeUtils::GetDataTypeLength(data_type, size_type), PARAM_INVALID, | ||||
| "dataType no define size , parse ge_desc failed."); | "dataType no define size , parse ge_desc failed."); | ||||
| // get size | // get size | ||||
| int64_t tmp_dim = 0; | |||||
| for (uint32_t j = 0; j < ge_desc.GetShape().GetDimNum(); ++j) { | for (uint32_t j = 0; j < ge_desc.GetShape().GetDimNum(); ++j) { | ||||
| tmp_dim = ge_desc.GetShape().GetDim(j); | |||||
| int64_t tmp_dim = ge_desc.GetShape().GetDim(j); | |||||
| // The shape infered by fusedbatchnormgrad and mean calling tensorflow is not accurate. | // The shape infered by fusedbatchnormgrad and mean calling tensorflow is not accurate. | ||||
| // Here, special treatment is given to the two operators. | // Here, special treatment is given to the two operators. | ||||