Merge pull request !470 from huanruizhi/ge_devpull/466/MERGE
| @@ -94,7 +94,7 @@ Status CaffeDataParser::ParseParamsForInput(const domi::caffe::LayerParameter *l | |||
| const ge::ParserContext &ctx = GetParserContext(); | |||
| std::map<std::string, std::vector<int64_t>> input_dims = ctx.input_dims; | |||
| string name = layer->name(); | |||
| auto search = input_dims.find(name); | |||
| std::map<std::string, std::vector<int64_t>>::const_iterator search = input_dims.find(name); | |||
| if (search == input_dims.end()) { | |||
| REPORT_INPUT_ERROR("E11005", std::vector<std::string>({"input"}), std::vector<std::string>({layer->name()})); | |||
| GELOGE(PARAM_INVALID, "[Check][Param] Caffe prototxt has no input_param or user " | |||
| @@ -139,7 +139,7 @@ Status CaffeDataParser::ParseParamsForDummyData(const domi::caffe::LayerParamete | |||
| const ge::ParserContext &ctx = GetParserContext(); | |||
| std::map<std::string, std::vector<int64_t>> input_dims = ctx.input_dims; | |||
| string name = layer->name(); | |||
| auto search = input_dims.find(name); | |||
| std::map<std::string, std::vector<int64_t>>::const_iterator search = input_dims.find(name); | |||
| if (search == input_dims.end()) { | |||
| REPORT_INPUT_ERROR("E11005", std::vector<std::string>({"input"}), std::vector<std::string>({layer->name()})); | |||
| GELOGE(PARAM_INVALID, "[Check][Param] Caffe prototxt has no input_param or user " | |||
| @@ -19,6 +19,7 @@ | |||
| #include "parser/common/op_parser_factory.h" | |||
| #include "common/util/error_manager/error_manager.h" | |||
| #include "framework/omg/parser/parser_types.h" | |||
| #include "graph/def_types.h" | |||
| using namespace ge::parser; | |||
| using domi::caffe::BlobProto; | |||
| @@ -107,7 +108,7 @@ Status CaffeOpParser::ParseWeightType(const BlobProto &proto, const ge::GeShape | |||
| for (int i = 0; i < size; ++i) { | |||
| buf[i] = proto.double_data(i); | |||
| } | |||
| GE_IF_BOOL_EXEC(weight->SetData(reinterpret_cast<uint8_t *>(buf.get()), size * sizeof(float)) != ge::GRAPH_SUCCESS, | |||
| GE_IF_BOOL_EXEC(weight->SetData(PtrToPtr<float, uint8_t>(buf.get()), size * sizeof(float)) != ge::GRAPH_SUCCESS, | |||
| GELOGW("SetData failed for GeTensor.");); // no need to return | |||
| } else if (proto.int8_data().length() > 0) { | |||
| if (size != static_cast<int>(proto.int8_data().length())) { | |||
| @@ -121,7 +122,7 @@ Status CaffeOpParser::ParseWeightType(const BlobProto &proto, const ge::GeShape | |||
| const char *data_ptr = proto.int8_data().data(); | |||
| GE_CHECK_NOTNULL(data_ptr); | |||
| GE_IF_BOOL_EXEC( | |||
| weight->SetData(reinterpret_cast<const uint8_t *>(data_ptr), size * sizeof(int8_t)) != ge::GRAPH_SUCCESS, | |||
| weight->SetData(PtrToPtr<const char, const uint8_t>(data_ptr), size * sizeof(int8_t)) != ge::GRAPH_SUCCESS, | |||
| GELOGW("SetData failed for GeTensor.");); // no need to return | |||
| dtype = ge::DT_INT8; | |||
| } else if (proto.int32_data_size() > 0) { | |||
| @@ -139,7 +140,7 @@ Status CaffeOpParser::ParseWeightType(const BlobProto &proto, const ge::GeShape | |||
| int32_weight_buf[i] = proto.int32_data(i); | |||
| } | |||
| GE_IF_BOOL_EXEC( | |||
| weight->SetData(reinterpret_cast<uint8_t *>(int32_weight_buf.get()), size * sizeof(int32_t)) != ge::GRAPH_SUCCESS, | |||
| weight->SetData(PtrToPtr<int32_t, uint8_t>(int32_weight_buf.get()), size * sizeof(int32_t)) != ge::GRAPH_SUCCESS, | |||
| GELOGW("SetData failed for GeTensor.");); // no need to return | |||
| dtype = ge::DT_INT32; | |||
| } else if (proto.uint64_data_size() > 0) { | |||
| @@ -156,7 +157,7 @@ Status CaffeOpParser::ParseWeightType(const BlobProto &proto, const ge::GeShape | |||
| for (int i = 0; i < size; ++i) { | |||
| uint64_weight_buf[i] = proto.uint64_data(i); | |||
| } | |||
| GE_IF_BOOL_EXEC(weight->SetData(reinterpret_cast<uint8_t *>(uint64_weight_buf.get()), size * sizeof(uint64_t)) != | |||
| GE_IF_BOOL_EXEC(weight->SetData(PtrToPtr<uint64_t, uint8_t>(uint64_weight_buf.get()), size * sizeof(uint64_t)) != | |||
| ge::GRAPH_SUCCESS, | |||
| GELOGW("SetData failed for GeTensor.");); // no need to return | |||
| dtype = ge::DT_UINT64; | |||
| @@ -173,7 +174,7 @@ Status CaffeOpParser::ParseWeightType(const BlobProto &proto, const ge::GeShape | |||
| const float *data_ptr = proto.data().data(); | |||
| GE_CHECK_NOTNULL(data_ptr); | |||
| GE_IF_BOOL_EXEC( | |||
| weight->SetData(reinterpret_cast<const uint8_t *>(data_ptr), size * sizeof(float)) != ge::GRAPH_SUCCESS, | |||
| weight->SetData(PtrToPtr<const float, const uint8_t>(data_ptr), size * sizeof(float)) != ge::GRAPH_SUCCESS, | |||
| GELOGW("SetData failed for GeTensor.");); // no need to return | |||
| } | |||
| ge::GeTensorDesc weight_desc = ge::GeTensorDesc(); | |||
| @@ -755,7 +755,8 @@ Status CaffeModelParser::GetCustomOp(const domi::caffe::LayerParameter &layer, v | |||
| } | |||
| if (is_search_built_in_layer) { | |||
| const google::protobuf::Message *layer_message = reinterpret_cast<const google::protobuf::Message *>(&layer); | |||
| const google::protobuf::Message *layer_message = PtrToPtr<const domi::caffe::LayerParameter, | |||
| const google::protobuf::Message>(&layer); | |||
| Status status = CreateCustomOperator(op_name, op_type, layer_message, 0, operators); | |||
| if (status != SUCCESS || operators.empty()) { | |||
| GELOGE(status, "[Create][CustomOperator] failed, name: %s, type: %s.", op_name.c_str(), op_type.c_str()); | |||
| @@ -1025,7 +1026,8 @@ Status CaffeModelParser::AddEdges(ge::ComputeGraphPtr &graph) { | |||
| // Find the layer for this output | |||
| auto top_node_iter = node_map.find(top_blob_layer_pair.first); | |||
| // Find the layer for this input | |||
| auto bottom_node_iter = node_map.find(bottom_blob_layer_pair.first); | |||
| std::map<std::string, ge::NodePtr>::const_iterator bottom_node_iter = | |||
| node_map.find(bottom_blob_layer_pair.first); | |||
| if (top_node_iter != node_map.end() && bottom_node_iter != node_map.end()) { | |||
| // Output node top_node_iter->second, | |||
| // Output index top_blob_layer_pair.second | |||
| @@ -1095,7 +1097,7 @@ Status CaffeModelParser::AddUserOutNodesTop() { | |||
| const std::vector<std::pair<std::string, int32_t>> &user_out_nodes = ge::GetParserContext().user_out_nodes; | |||
| int net_output_num = user_out_nodes.size(); | |||
| for (const auto &out_pair : user_out_nodes) { | |||
| auto layer_iter = layer_tops_map_.find(out_pair.first); | |||
| std::map<std::string, std::vector<std::string>>::const_iterator layer_iter = layer_tops_map_.find(out_pair.first); | |||
| GELOGI("Add to output, node name: %s", out_pair.first.c_str()); | |||
| if (layer_iter != layer_tops_map_.end()) { | |||
| if (static_cast<uint32_t>(out_pair.second) >= (layer_iter->second).size()) { | |||
| @@ -1110,7 +1112,7 @@ Status CaffeModelParser::AddUserOutNodesTop() { | |||
| } | |||
| string top_name = layer_iter->second[out_pair.second]; | |||
| auto top_node_iter = node_map.find(out_pair.first); | |||
| std::map<std::string, ge::NodePtr>::const_iterator top_node_iter = node_map.find(out_pair.first); | |||
| if (top_node_iter != node_map.end()) { | |||
| ge::GetParserContext().out_tensor_names.push_back(top_name); | |||
| GELOGI("The top of out node [%s] is [%s]", out_pair.first.c_str(), top_name.c_str()); | |||
| @@ -1142,7 +1144,8 @@ Status CaffeModelParser::AddOutputTop(const domi::caffe::NetParameter &proto_mes | |||
| top = RemapTopNameByLayer(layer, top, i); | |||
| } | |||
| auto t_iter = top_blobs_map_.find(top); | |||
| std::map<std::string, std::vector<std::pair<std::string, int32_t>>>::const_iterator t_iter = | |||
| top_blobs_map_.find(top); | |||
| GE_RETURN_WITH_LOG_IF_FALSE(t_iter != top_blobs_map_.end(), | |||
| "[Check][Param]Failed to find top: %s, layer name:%s", top.c_str(), | |||
| @@ -1156,7 +1159,7 @@ Status CaffeModelParser::AddOutputTop(const domi::caffe::NetParameter &proto_mes | |||
| // If not found, add to the output side of the output | |||
| // Find the layer for this output | |||
| auto top_node_iter = node_map.find(layer.name()); | |||
| std::map<std::string, ge::NodePtr>::const_iterator top_node_iter = node_map.find(layer.name()); | |||
| GELOGI("output in top_blob: %s", layer.name().c_str()); | |||
| if (top_node_iter != node_map.end()) { | |||
| ge::GetParserContext().out_tensor_names.push_back(top_origin); | |||
| @@ -1392,7 +1395,7 @@ void CaffeModelParser::SaveOrigionLayerTops(domi::caffe::LayerParameter &layer) | |||
| for (auto top : layer.top()) { | |||
| tops.push_back(top); | |||
| } | |||
| auto it = layer_tops_map_.find(name); | |||
| std::map<std::string, std::vector<std::string>>::const_iterator it = layer_tops_map_.find(name); | |||
| if (it == layer_tops_map_.end()) { | |||
| layer_tops_map_[name] = tops; | |||
| } | |||
| @@ -1679,7 +1682,7 @@ Status CaffeWeightsParser::ParseFromMemory(const char *data, uint32_t size, ge:: | |||
| // Resolve proto file to netparameter | |||
| NetParameter proto; | |||
| bool success = ge::parser::ReadProtoFromArray(reinterpret_cast<const char *>(data), static_cast<int>(size), &proto); | |||
| bool success = ge::parser::ReadProtoFromArray(data, static_cast<int>(size), &proto); | |||
| if (!success) { | |||
| REPORT_CALL_ERROR("E19999", "ReadProtoFromArray failed."); | |||
| GELOGE(domi::PARSE_WEIGHTS_FAILED, "[Read][Proto] from Memory fail"); | |||
| @@ -1920,7 +1923,7 @@ Status CaffeWeightsParser::ParseLayerField(const google::protobuf::Reflection *r | |||
| const google::protobuf::FieldDescriptor *field, | |||
| google::protobuf::Message *layer) { | |||
| GELOGD("Start to parse field: %s.", field->name().c_str()); | |||
| domi::caffe::LayerParameter *layer_proto = reinterpret_cast<domi::caffe::LayerParameter *>(layer); | |||
| domi::caffe::LayerParameter *layer_proto = PtrToPtr<google::protobuf::Message, domi::caffe::LayerParameter>(layer); | |||
| string filed_name = field->name(); | |||
| #define CASE_FIELD_NAME(kName, method) \ | |||
| if (filed_name == kField##kName) { \ | |||
| @@ -1975,8 +1978,7 @@ Status CaffeWeightsParser::ConvertBlobsProto(const google::protobuf::Message *me | |||
| CAFFE_CHECK_NULL_AND_REPROT_ERRORMSG(blobs_reflection, "Get Reflection failed in google::protobuf::Message"); | |||
| vector<const google::protobuf::FieldDescriptor *> field_desc; | |||
| blobs_reflection->ListFields(*message, &field_desc); | |||
| domi::caffe::BlobProto *blobs_proto = reinterpret_cast<domi::caffe::BlobProto *>(blobs); | |||
| domi::caffe::BlobProto *blobs_proto = PtrToPtr<google::protobuf::Message, domi::caffe::BlobProto>(blobs); | |||
| for (auto &field : field_desc) { | |||
| GE_CHECK_NOTNULL(field); | |||
| @@ -2025,7 +2027,7 @@ Status CaffeWeightsParser::ConvertBlobShapeProto(const google::protobuf::Message | |||
| vector<const google::protobuf::FieldDescriptor *> field_desc; | |||
| reflection->ListFields(*message, &field_desc); | |||
| domi::caffe::BlobShape *shape_proto = reinterpret_cast<domi::caffe::BlobShape *>(dest_message); | |||
| domi::caffe::BlobShape *shape_proto = PtrToPtr<google::protobuf::Message, domi::caffe::BlobShape>(dest_message); | |||
| for (auto &field : field_desc) { | |||
| if (field->name() != kFieldDim) { | |||
| @@ -2048,7 +2050,7 @@ Status CaffeWeightsParser::ConvertConvParamProto(const google::protobuf::Message | |||
| reflection->ListFields(*message, &field_desc); | |||
| domi::caffe::ConvolutionParameter *conv_param_proto = | |||
| reinterpret_cast<domi::caffe::ConvolutionParameter *>(dest_message); | |||
| PtrToPtr<google::protobuf::Message, domi::caffe::ConvolutionParameter>(dest_message); | |||
| for (auto &field : field_desc) { | |||
| if (field->name() != kFieldBiasTerm) { | |||
| @@ -2068,7 +2070,7 @@ Status CaffeWeightsParser::ConvertInnerProdcutProto(const google::protobuf::Mess | |||
| reflection->ListFields(*message, &field_desc); | |||
| domi::caffe::InnerProductParameter *inner_product_proto = | |||
| reinterpret_cast<domi::caffe::InnerProductParameter *>(dest_message); | |||
| PtrToPtr<google::protobuf::Message, domi::caffe::InnerProductParameter>(dest_message); | |||
| for (auto &field : field_desc) { | |||
| if (field->name() != kFieldBiasTerm) { | |||
| @@ -2125,7 +2127,8 @@ Status CaffeWeightsParser::CheckLayersSize(const google::protobuf::Message *mess | |||
| Status CaffeWeightsParser::ConvertLayerParameter(const google::protobuf::Message *layer_message, | |||
| ge::ComputeGraphPtr &graph) { | |||
| vector<string> need_share_layers; | |||
| const domi::caffe::LayerParameter *layer = reinterpret_cast<const domi::caffe::LayerParameter *>(layer_message); | |||
| const domi::caffe::LayerParameter *layer = | |||
| PtrToPtr<google::protobuf::Message, domi::caffe::LayerParameter>(layer_message); | |||
| const string &shared_layer_name = layer->name(); | |||
| const string &layer_type = layer->type(); | |||
| for (auto p_iter = params_share_map.begin(); p_iter != params_share_map.end(); ++p_iter) { | |||
| @@ -2159,7 +2162,7 @@ Status CaffeWeightsParser::ConvertLayerParameter(const google::protobuf::Message | |||
| } | |||
| // The weight processing also needs to judge the duplicate operator, which is reserved here and processed later. | |||
| auto iter = caffe_op_map.find(layer_type); | |||
| std::map<std::string, std::string>::const_iterator iter = caffe_op_map.find(layer_type); | |||
| if (iter == caffe_op_map.end()) { | |||
| GELOGW("Unrecognized layer type %s , layer name: %s, layer ignored.", layer_type.c_str(), layer_name.c_str()); | |||
| continue; | |||
| @@ -2285,7 +2288,7 @@ Status CaffeWeightsParser::ConvertNetParameter(const NetParameter ¶m, ge::Co | |||
| } | |||
| // The weight processing also needs to judge the duplicate operator, which is reserved here and processed later. | |||
| auto iter = caffe_op_map.find(layer.type()); | |||
| std::map<std::string, std::string>::const_iterator iter = caffe_op_map.find(layer.type()); | |||
| if (iter == caffe_op_map.end()) { | |||
| GELOGW("Unrecognized layer type %s , layer name: %s, layer ignored.", layer.type().c_str(), layer_name.c_str()); | |||
| continue; | |||
| @@ -128,7 +128,7 @@ Status CaffeReshapeParser::AddConstInput(ge::NodePtr &node) { | |||
| data[i] = attr_shape[i]; | |||
| } | |||
| GE_IF_BOOL_EXEC( | |||
| constTensor->SetData(reinterpret_cast<uint8_t *>(data.get()), dims_size * sizeof(int64_t)) != ge::GRAPH_SUCCESS, | |||
| constTensor->SetData(PtrToPtr<int64_t, uint8_t>(data.get()), dims_size * sizeof(int64_t)) != ge::GRAPH_SUCCESS, | |||
| GELOGW("SetData failed for GeTensor.");); // no need to return | |||
| // construct const node and add edge | |||
| @@ -492,7 +492,7 @@ domi::Status AclGrphParseUtil::GetOutputLeaf(NodePtr node, | |||
| } | |||
| domi::Status AclGrphParseUtil::GetDefaultOutInfo(ge::ComputeGraphPtr &compute_graph, | |||
| std::vector<std::pair<ge::NodePtr, int32_t>> &output_nodes_info) { | |||
| std::vector<std::pair<ge::NodePtr, int32_t>> &output_nodes_info) { | |||
| std::vector<std::pair<std::string, int32_t>> default_out_nodes = ge::GetParserContext().default_out_nodes; | |||
| if (!default_out_nodes.empty()) { | |||
| for (size_t i = 0; i < default_out_nodes.size(); ++i) { | |||
| @@ -820,7 +820,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromArray(const v | |||
| "or size is 0, check invalid"); return false, | |||
| "[Check][Param]incorrect parameter. proto is nullptr || data is nullptr || size is 0"); | |||
| google::protobuf::io::CodedInputStream coded_stream(reinterpret_cast<uint8_t *>(const_cast<void *>(data)), size); | |||
| google::protobuf::io::CodedInputStream coded_stream(PtrToPtr<void, uint8_t>(const_cast<void *>(data)), size); | |||
| return ReadProtoFromCodedInputStream(coded_stream, proto); | |||
| } | |||
| @@ -901,7 +901,7 @@ Status GetOriginalType(const ge::NodePtr &node, string &type) { | |||
| return SUCCESS; | |||
| } | |||
| FMK_FUNC_HOST_VISIBILITY bool ValidateStr(const std::string &str, const std::string &mode) { | |||
| FMK_FUNC_HOST_VISIBILITY bool ValidateStr(const std::string &filePath, const std::string &mode) { | |||
| char ebuff[kMaxBuffSize]; | |||
| regex_t reg; | |||
| int cflags = REG_EXTENDED | REG_NOSUB; | |||
| @@ -913,7 +913,7 @@ FMK_FUNC_HOST_VISIBILITY bool ValidateStr(const std::string &str, const std::str | |||
| return true; | |||
| } | |||
| ret = regexec(®, str.c_str(), 0, nullptr, 0); | |||
| ret = regexec(®, filePath.c_str(), 0, nullptr, 0); | |||
| if (ret) { | |||
| regerror(ret, ®, ebuff, kMaxBuffSize); | |||
| GELOGE(ge::PARAM_INVALID, "[Invoke][RegExec] failed, reason: %s", ebuff); | |||
| @@ -60,7 +60,7 @@ class DataOpParser { | |||
| * @param [in] 4D shape information (dimensions) | |||
| * @param [out] Save converted shap information | |||
| */ | |||
| static Status Init5DInputTensor(const std::vector<int64_t> &shape, ge::GeTensorDesc &tensorDesc); | |||
| static Status Init5DInputTensor(const std::vector<int64_t> &shape, ge::GeTensorDesc &tensor_desc); | |||
| /** | |||
| * @ingroup domi_omg | |||
| @@ -98,7 +98,7 @@ class DataOpParser { | |||
| * @return SUCCESS Convert success | |||
| * @return FAILED Convert failed | |||
| */ | |||
| static Status InitNDTensor(const std::vector<int64_t> &shape, ge::DataType data_type, ge::GeTensorDesc &desc); | |||
| static Status InitNDTensor(const std::vector<int64_t> &shape, ge::DataType data_type, ge::GeTensorDesc &tensor_desc); | |||
| }; | |||
| } // namespace ge | |||
| @@ -114,7 +114,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY domi::Status ConvertToOpDesc(co | |||
| if (op_attr_pair.second.value_.value_case() == domi::AttrDef::kBt) { | |||
| auto &buffer = op_attr_pair.second.value_.bt(); | |||
| (void)ge::AttrUtils::SetZeroCopyBytes(op_def, op_attr_pair.first, | |||
| ge::Buffer::CopyFrom(reinterpret_cast<uint8_t *>(const_cast<char *>(buffer.data())), buffer.size())); | |||
| ge::Buffer::CopyFrom(PtrToPtr<void, uint8_t>(const_cast<char *>(buffer.data())), buffer.size())); | |||
| } | |||
| if (op_attr_pair.second.value_.value_case() == domi::AttrDef::kS) { | |||
| @@ -50,7 +50,7 @@ FMK_FUNC_HOST_VISIBILITY std::shared_ptr<OpParserFactory> OpParserFactory::Insta | |||
| // Instances cannot be a member of a class because they may be used before initialization, resulting in a run error. | |||
| static std::map<domi::FrameworkType, std::shared_ptr<OpParserFactory>> instances; | |||
| auto iter = instances.find(framework); | |||
| std::map<domi::FrameworkType, std::shared_ptr<OpParserFactory>>::const_iterator iter = instances.find(framework); | |||
| if (iter == instances.end()) { | |||
| std::shared_ptr<OpParserFactory> instance(new (std::nothrow) OpParserFactory()); | |||
| if (instance == nullptr) { | |||
| @@ -67,7 +67,7 @@ FMK_FUNC_HOST_VISIBILITY std::shared_ptr<OpParserFactory> OpParserFactory::Insta | |||
| FMK_FUNC_HOST_VISIBILITY std::shared_ptr<OpParser> OpParserFactory::CreateOpParser(const std::string &op_type) { | |||
| // First look for CREATOR_FUN based on OpType, then call CREATOR_FUN to create OpParser. | |||
| auto iter = op_parser_creator_map_.find(op_type); | |||
| std::map<std::string, CREATOR_FUN>::const_iterator iter = op_parser_creator_map_.find(op_type); | |||
| if (iter != op_parser_creator_map_.end()) { | |||
| return iter->second(); | |||
| } | |||
| @@ -78,7 +78,7 @@ FMK_FUNC_HOST_VISIBILITY std::shared_ptr<OpParser> OpParserFactory::CreateOpPars | |||
| FMK_FUNC_HOST_VISIBILITY std::shared_ptr<OpParser> OpParserFactory::CreateFusionOpParser(const std::string &op_type) { | |||
| // First look for CREATOR_FUN based on OpType, then call CREATOR_FUN to create OpParser. | |||
| auto iter = fusion_op_parser_creator_map_.find(op_type); | |||
| std::map<std::string, CREATOR_FUN>::const_iterator iter = fusion_op_parser_creator_map_.find(op_type); | |||
| if (iter != fusion_op_parser_creator_map_.end()) { | |||
| return iter->second(); | |||
| } | |||
| @@ -102,12 +102,12 @@ FMK_FUNC_HOST_VISIBILITY void OpParserFactory::RegisterCreator(const std::string | |||
| FMK_FUNC_HOST_VISIBILITY bool OpParserFactory::OpParserIsRegistered(const std::string &op_type, bool is_fusion_op) { | |||
| if (is_fusion_op) { | |||
| auto iter = fusion_op_parser_creator_map_.find(op_type); | |||
| std::map<std::string, CREATOR_FUN>::const_iterator iter = fusion_op_parser_creator_map_.find(op_type); | |||
| if (iter != fusion_op_parser_creator_map_.end()) { | |||
| return true; | |||
| } | |||
| } else { | |||
| auto iter = op_parser_creator_map_.find(op_type); | |||
| std::map<std::string, CREATOR_FUN>::const_iterator iter = op_parser_creator_map_.find(op_type); | |||
| if (iter != op_parser_creator_map_.end()) { | |||
| return true; | |||
| } | |||
| @@ -62,7 +62,7 @@ public: | |||
| /// @return others optimized failed | |||
| /// @author | |||
| /// | |||
| static Status Run(const ge::ComputeGraphPtr &graph, std::vector<std::pair<std::string, GraphPass *>> &passes); | |||
| static Status Run(const ge::ComputeGraphPtr &graph, std::vector<std::pair<std::string, GraphPass *>> &names_to_passes); | |||
| ~PassManager(); | |||
| @@ -425,7 +425,8 @@ Status ProtoFileParser::FindConflictLine(const char *proto_file, int identifier, | |||
| void ProtoFileParser::CheckConflictOp(const char *caffe_proto_file, const char *custom_proto_file, | |||
| std::map<std::string, std::pair<int, string>> &caffe_op_identifier_map, | |||
| std::map<std::string, std::pair<int, string>> &custom_op_identifier_map) { | |||
| for (auto iter = custom_op_identifier_map.begin(); iter != custom_op_identifier_map.end(); ++iter) { | |||
| std::map<std::string, std::pair<int, string>>::const_iterator iter = custom_op_identifier_map.begin(); | |||
| for (; iter != custom_op_identifier_map.end(); ++iter) { | |||
| if (caffe_op_identifier_map.count(iter->first) > 0) { | |||
| string message_name = iter->first; | |||
| auto caffe_pair = caffe_op_identifier_map[iter->first]; | |||
| @@ -452,7 +453,8 @@ void ProtoFileParser::CheckConflictOp(const char *caffe_proto_file, const char * | |||
| void ProtoFileParser::CheckConflictIdentifier(const char *caffe_proto_file, const char *custom_proto_file, | |||
| std::map<int, std::pair<string, string>> caffe_identifier_op_map, | |||
| std::map<int, std::pair<string, string>> custom_identifier_op_map) { | |||
| for (auto iter = custom_identifier_op_map.begin(); iter != custom_identifier_op_map.end(); ++iter) { | |||
| std::map<int, std::pair<string, string>>::const_iterator iter = custom_identifier_op_map.begin(); | |||
| for (; iter != custom_identifier_op_map.end(); ++iter) { | |||
| if (caffe_identifier_op_map.count(iter->first) > 0) { | |||
| int identifier = iter->first; | |||
| auto caffe_pair = caffe_identifier_op_map[iter->first]; | |||
| @@ -105,7 +105,7 @@ void TBEPluginLoader::GetCustomOpPath(std::string &customop_path) { | |||
| GELOGI("Enter get custom op path schedule"); | |||
| std::string fmk_type; | |||
| domi::FrameworkType type = domi::TENSORFLOW; | |||
| auto it = options_.find(FRAMEWORK_TYPE); | |||
| std::map<string, string>::const_iterator it = options_.find(FRAMEWORK_TYPE); | |||
| if (it != options_.end()) { | |||
| type = static_cast<domi::FrameworkType>(std::strtol(it->second.c_str(), nullptr, 10)); | |||
| } | |||
| @@ -71,7 +71,7 @@ Status OnnxConstantParser::ParseConvertData(const ge::onnx::TensorProto &tensor_ | |||
| }; | |||
| int32_t datatype_val_size = 0; | |||
| auto iter = datatype_val_size_map.find(data_type); | |||
| std::map<uint32_t, int32_t>::const_iterator iter = datatype_val_size_map.find(data_type); | |||
| if (iter != datatype_val_size_map.end()) { | |||
| datatype_val_size = iter->second; | |||
| } else { | |||
| @@ -91,7 +91,7 @@ Status OnnxConstantParser::ParseConvertData(const ge::onnx::TensorProto &tensor_ | |||
| if (data_type == OnnxDataType::STRING) { | |||
| tensor.SetData(tensor_proto.raw_data().c_str()); | |||
| } else { | |||
| tensor.SetData(reinterpret_cast<const uint8_t *>(tensor_proto.raw_data().c_str()), | |||
| tensor.SetData(PtrToPtr<const char_t, const uint8_t>(tensor_proto.raw_data().c_str()), | |||
| tensor_proto.raw_data().size()); | |||
| } | |||
| GELOGD("Raw data size is : %zu", tensor_proto.raw_data().size()); | |||
| @@ -65,7 +65,7 @@ class PARSER_FUNC_VISIBILITY OnnxConstantParser : public OnnxOpParser { | |||
| *(addr_trans.get() + i) = static_cast<bool>( | |||
| std::fabs(*((addr).get() + i)) > std::numeric_limits<T>::epsilon()); | |||
| } | |||
| (tensor).SetData(reinterpret_cast<uint8_t *>(addr_trans.get()), (count) * sizeof(bool)); | |||
| (tensor).SetData(PtrToPtr<bool, uint8_t>(addr_trans.get()), (count) * sizeof(bool)); | |||
| break; | |||
| } | |||
| #define CASE_SET_DATA(dt_type, value_type, addr, count, tensor) \ | |||
| @@ -384,7 +384,7 @@ Status OnnxModelParser::ConstructOriType(const ge::onnx::NodeProto *node_proto, | |||
| std::string domain = node_proto->domain(); | |||
| int64_t version = 0; | |||
| if (!domain.empty()) { | |||
| auto it = domain_verseion_.find(domain); | |||
| std::map<std::string, int64_t>::const_iterator it = domain_verseion_.find(domain); | |||
| if (it != domain_verseion_.end()) { | |||
| version = it->second; | |||
| } else { | |||
| @@ -493,14 +493,14 @@ Status OnnxModelParser::SetOperatorInputs() { | |||
| std::vector<std::pair<std::string, int>> &output_node_indexs = out_iter->second; | |||
| for (auto input_node_index : input_node_indexs) { | |||
| for (auto out_node_index : output_node_indexs) { | |||
| auto input_op_iter = name_operator_.find(input_node_index.first); | |||
| std::map<std::string, ge::Operator>::const_iterator input_op_iter = name_operator_.find(input_node_index.first); | |||
| if (input_op_iter == name_operator_.end()) { | |||
| REPORT_INNER_ERROR("E19999", "Node: %s can not find in name_operator map.", input_node_index.first.c_str()); | |||
| GELOGE(INTERNAL_ERROR, "[Check][Param] Node: %s can not find in name_operator map.", | |||
| input_node_index.first.c_str()); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| auto output_op_iter = name_operator_.find(out_node_index.first); | |||
| std::map<std::string, ge::Operator>::const_iterator output_op_iter = name_operator_.find(out_node_index.first); | |||
| if (output_op_iter == name_operator_.end()) { | |||
| REPORT_INNER_ERROR("E19999", "Node: %s can not find in name_operator map.", out_node_index.first.c_str()); | |||
| GELOGE(INTERNAL_ERROR, "[Check][Param] Node: %s can not find in name_operator map.", | |||
| @@ -665,7 +665,7 @@ Status OnnxModelParser::GetGraphInputs(ge::onnx::GraphProto &onnx_graph, std::ve | |||
| } | |||
| } | |||
| for (auto in_name : input_node_names_) { | |||
| auto in_op = name_operator_.find(in_name); | |||
| std::map<std::string, ge::Operator>::const_iterator in_op = name_operator_.find(in_name); | |||
| if (in_op == name_operator_.end()) { | |||
| GELOGE(PARAM_INVALID, "[Get][Inputs] Model assigned input node name: %s can not find in graph.", | |||
| in_name.c_str()); | |||
| @@ -682,7 +682,8 @@ Status OnnxModelParser::GetGraphInputs(ge::onnx::GraphProto &onnx_graph, std::ve | |||
| Status OnnxModelParser::GetGraphOutputs(std::vector<std::pair<Operator, std::vector<size_t>>> &output_ops, | |||
| ParserUtils::OutputMapping &out_tensor_to_nodes) { | |||
| for (auto output_name : output_node_names_) { | |||
| auto itr = outputs_map_.find(output_name); | |||
| std::map<std::string, std::vector<std::pair<std::string, int>>>::const_iterator itr = | |||
| outputs_map_.find(output_name); | |||
| if (itr == outputs_map_.end()) { | |||
| GELOGE(PARAM_INVALID, "[Get][Outputs] Can not find output:%s in graph.", output_name.c_str()); | |||
| REPORT_INNER_ERROR("E19999", "[Get][Outputs] Can not find output:%s in graph.", output_name.c_str()); | |||
| @@ -692,7 +693,7 @@ Status OnnxModelParser::GetGraphOutputs(std::vector<std::pair<Operator, std::vec | |||
| std::vector<std::pair<std::string, int>> node_names_indexes = itr->second; | |||
| for (const auto &node_name_index : node_names_indexes) { | |||
| auto node_name = node_name_index.first; | |||
| auto out_op_itr = name_operator_.find(node_name); | |||
| std::map<std::string, ge::Operator>::const_iterator out_op_itr = name_operator_.find(node_name); | |||
| if (out_op_itr == name_operator_.end()) { | |||
| GELOGE(PARAM_INVALID, "[Get][Operator] Can not find operator: %s in graph.", node_name.c_str()); | |||
| REPORT_INNER_ERROR("E19999", "Can not find operator: %s in graph.", node_name.c_str()); | |||
| @@ -815,7 +816,7 @@ Status OnnxModelParser::ModelParseToGraph(const ge::onnx::ModelProto &onnx_model | |||
| bool is_subgraph = (arg.parent_node != nullptr) ? true : false; | |||
| if (arg.onnx_graph == nullptr) { | |||
| auto itr = name_to_onnx_graph.find(arg.graph_name); | |||
| std::map<std::string, ge::onnx::GraphProto *>::const_iterator itr = name_to_onnx_graph.find(arg.graph_name); | |||
| if (itr == name_to_onnx_graph.end()) { | |||
| GELOGE(FAILED, "[Find][OnnxGraph] Can not find onnx graph, graph:%s.", arg.graph_name.c_str()); | |||
| REPORT_INNER_ERROR("E19999", "Can not find onnx graph, graph:%s.", arg.graph_name.c_str()); | |||
| @@ -96,7 +96,7 @@ class PARSER_FUNC_VISIBILITY OnnxModelParser : public domi::ModelParser { | |||
| Status ConstructOriType(const ge::onnx::NodeProto *node_proto, std::string &ori_type); | |||
| Status AdapterOpType(const ge::onnx::NodeProto *node_proto, std::string &ori_type, std::string &om_type); | |||
| Status AdapterOpType(const ge::onnx::NodeProto *node_proto, std::string &ori_type, std::string &op_type); | |||
| Status TransNodeToOperator(const ge::onnx::NodeProto *node_proto, ge::Operator &op, const string &op_type) const; | |||
| @@ -106,7 +106,7 @@ class PARSER_FUNC_VISIBILITY OnnxModelParser : public domi::ModelParser { | |||
| Status GetGraphInputs(ge::onnx::GraphProto &onnx_graph, std::vector<ge::Operator> &input_ops); | |||
| Status GetGraphOutputs(std::vector<std::pair<Operator, std::vector<size_t>>> &outputs, | |||
| Status GetGraphOutputs(std::vector<std::pair<Operator, std::vector<size_t>>> &output_ops, | |||
| ParserUtils::OutputMapping &out_tensor_to_nodes); | |||
| Status Prechecker(ge::onnx::GraphProto &onnx_graph); | |||
| @@ -115,7 +115,7 @@ class PARSER_FUNC_VISIBILITY OnnxModelParser : public domi::ModelParser { | |||
| Status GetModelFromMemory(const char *data, uint32_t size, ge::onnx::ModelProto &onnx_model) const; | |||
| Status ModelParseToGraph(const ge::onnx::ModelProto &onnx_model, ge::Graph &graph); | |||
| Status ModelParseToGraph(const ge::onnx::ModelProto &onnx_model, ge::Graph &root_graph); | |||
| Status ModelParseToGraphImpl(bool is_subgraph, ge::onnx::GraphProto &onnx_graph, ge::Graph &graph); | |||
| @@ -104,7 +104,7 @@ domi::Status IfSubgraphAdapter::GetSubgraphsAllInputs(ge::onnx::GraphProto &onnx | |||
| } | |||
| for (const auto &input : graph_inputs) { | |||
| auto out_iter = graph_outputs.find(input); | |||
| std::set<std::string>::const_iterator out_iter = graph_outputs.find(input); | |||
| if (out_iter == graph_outputs.end()) { | |||
| // Record input node need to be constructed | |||
| all_inputs.emplace(input); | |||
| @@ -24,7 +24,7 @@ | |||
| namespace ge { | |||
| class PARSER_FUNC_VISIBILITY IfSubgraphAdapter : public SubgraphAdapter { | |||
| public: | |||
| domi::Status AdaptAndFindAllSubgraphs(ge::onnx::NodeProto *parent_op, | |||
| domi::Status AdaptAndFindAllSubgraphs(ge::onnx::NodeProto *parent_node, | |||
| std::vector<ge::onnx::GraphProto *> &onnx_graphs, | |||
| std::map<std::string, ge::onnx::GraphProto *> &name_to_onnx_graph) override; | |||
| @@ -26,7 +26,7 @@ SubgraphAdapterFactory* SubgraphAdapterFactory::Instance() { | |||
| std::shared_ptr<SubgraphAdapter> SubgraphAdapterFactory::CreateSubgraphAdapter( | |||
| const std::string &op_type) { | |||
| // First look for CREATOR_FUN based on OpType, then call CREATOR_FUN to create SubgraphAdapter. | |||
| auto iter = subgraph_adapter_creator_map_.find(op_type); | |||
| std::map<std::string, CREATOR_FUN>::const_iterator iter = subgraph_adapter_creator_map_.find(op_type); | |||
| if (iter != subgraph_adapter_creator_map_.end()) { | |||
| return iter->second(); | |||
| } | |||
| @@ -227,7 +227,7 @@ domi::Status GraphToFunctionDef::RecordResult(ge::ComputeGraphPtr graph, | |||
| GE_CHECK_NOTNULL(anchor); | |||
| GE_CHECK_NOTNULL(anchor->GetOwnerNode()->GetOpDesc()); | |||
| int32_t type = anchor->GetOwnerNode()->GetOpDesc()->GetOutputDesc(anchor->GetIdx()).GetDataType(); | |||
| auto iter = GE_TENSORFLOW_DATA_TYPE_MAP.find(type); | |||
| std::map<int32_t, int32_t>::const_iterator iter = GE_TENSORFLOW_DATA_TYPE_MAP.find(type); | |||
| GE_IF_BOOL_EXEC(iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | |||
| REPORT_INNER_ERROR("E19999", "datatype:%d of output:%d in node:%s:%s is not supported", | |||
| type, anchor->GetIdx(), anchor->GetOwnerNode()->GetName().c_str(), | |||
| @@ -304,7 +304,7 @@ domi::Status GraphToFunctionDef::RecordArg(ge::ComputeGraphPtr graph, const vect | |||
| GE_CHECK_NOTNULL_EXEC(tensor_desc_ptr, return domi::FAILED); | |||
| int32_t type = tensor_desc_ptr->GetDataType(); | |||
| auto iter = GE_TENSORFLOW_DATA_TYPE_MAP.find(type); | |||
| std::map<int32_t, int32_t>::const_iterator iter = GE_TENSORFLOW_DATA_TYPE_MAP.find(type); | |||
| GE_IF_BOOL_EXEC(iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | |||
| REPORT_INNER_ERROR("E19999", "datatype:%d of input:%d in node:%s:%s is not supported", | |||
| type, anchor->GetIdx(), anchor->GetOwnerNode()->GetName().c_str(), | |||
| @@ -52,7 +52,7 @@ class GraphToFunctionDef { | |||
| const string &name, FunctionDef *fdef); | |||
| static domi::Status BuildFunctionDef(ge::ComputeGraphPtr &graph, | |||
| const string &nme_in, | |||
| const string &name_in, | |||
| FunctionDefLibrary *library, | |||
| NodeDef *call_node_def, | |||
| vector<ge::InDataAnchorPtr> &in_anchor, | |||
| @@ -178,7 +178,7 @@ Status CollectNodeFuncs(vector<ge::NodePtr> &nodes, FunctionDefLibrary *library) | |||
| GE_IF_BOOL_EXEC( | |||
| AttrUtils::GetBytes(opDef, ge::ATTR_NAME_FRAMEWORK_FUNC_DEF, funcDefBytes), FunctionDefLibrary funcLib; | |||
| GE_CHECK_NOTNULL(funcDefBytes.GetData()); | |||
| string str(reinterpret_cast<char *>(funcDefBytes.GetData()), funcDefBytes.GetSize()); | |||
| string str(PtrToPtr<uint8_t, char_t>(funcDefBytes.GetData()), funcDefBytes.GetSize()); | |||
| GELOGI("FUNCDEF: Get function -> %s.", str.c_str()); GE_IF_BOOL_EXEC( | |||
| funcLib.ParseFromArray(funcDefBytes.GetData(), funcDefBytes.GetSize()), library->MergeFrom(funcLib))); | |||
| } | |||
| @@ -250,10 +250,10 @@ Status ParserGraphOptimizer::UpdateGraph(vector<NodePtr> &nodes) { | |||
| (void)AttrUtils::SetZeroCopyBytes( | |||
| fusion_node_opdef, ge::ATTR_NAME_FRAMEWORK_FUNC_DEF, | |||
| Buffer::CopyFrom(reinterpret_cast<const uint8_t *>(funcdefStr.data()), funcdefStr.length())); | |||
| Buffer::CopyFrom(PtrToPtr<const char_t, const uint8_t>(funcdefStr.data()), funcdefStr.length())); | |||
| (void)AttrUtils::SetZeroCopyBytes( | |||
| fusion_node_opdef, ge::ATTR_NAME_FRAMEWORK_NODE_DEF, | |||
| Buffer::CopyFrom(reinterpret_cast<const uint8_t *>(nodefStr.data()), nodefStr.length())); | |||
| Buffer::CopyFrom(PtrToPtr<const char_t, const uint8_t>(nodefStr.data()), nodefStr.length())); | |||
| (void)AttrUtils::SetInt(fusion_node_opdef, ge::ATTR_NAME_FRAMEWORK_FWK_TYPE, ge::GetParserContext().type); | |||
| @@ -381,7 +381,7 @@ Status ParserGraphOptimizer::RebuildOutputAnchors(vector<ge::OutDataAnchorPtr> & | |||
| GE_CHK_BOOL_EXEC(fusion_op_desc->AddOutputDesc(src_out_desc) == ge::GRAPH_SUCCESS, return FAILED); | |||
| ge::DataType data_type = src_out_desc.GetDataType(); | |||
| std::map<int32_t, int32_t>::const_iterator iter = GE_TENSORFLOW_DATA_TYPE_MAP.find((int32_t)data_type); | |||
| const std::map<int32_t, int32_t>::const_iterator iter = GE_TENSORFLOW_DATA_TYPE_MAP.find((int32_t)data_type); | |||
| GE_IF_BOOL_EXEC( | |||
| iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | |||
| REPORT_INNER_ERROR("E19999", "datatype:%d of output:%d in node:%s:%s is not supported", | |||
| @@ -417,7 +417,7 @@ Status ParserGraphOptimizer::RebuildInputAnchors(vector<ge::InDataAnchorPtr> &in | |||
| return FAILED, | |||
| "Add fusion_op_desc AddInputDesc failed"); | |||
| ge::DataType data_type = tensorDescPtr->GetDataType(); | |||
| std::map<int32_t, int32_t>::const_iterator iter = GE_TENSORFLOW_DATA_TYPE_MAP.find((int32_t)data_type); | |||
| const std::map<int32_t, int32_t>::const_iterator iter = GE_TENSORFLOW_DATA_TYPE_MAP.find((int32_t)data_type); | |||
| GE_IF_BOOL_EXEC( | |||
| iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | |||
| REPORT_INNER_ERROR("E19999", "datatype:%d of input:%d in node:%s:%s is not supported", | |||
| @@ -130,7 +130,7 @@ Status TensorFlowAutoMappingParserAdapter::ParseParams(const Message *op_src, ge | |||
| (void)AttrUtils::SetZeroCopyBytes( | |||
| op_dest, ge::ATTR_NAME_FRAMEWORK_NODE_DEF, | |||
| Buffer::CopyFrom(reinterpret_cast<const uint8_t *>(serialized_node.data()), serialized_node.length())); | |||
| Buffer::CopyFrom(PtrToPtr<const char_t, const uint8_t>(serialized_node.data()), serialized_node.length())); | |||
| GELOGI("node_def of %s is %s.", op_dest->GetName().c_str(), serialized_node.c_str()); | |||
| } | |||
| @@ -44,7 +44,7 @@ class PARSER_FUNC_VISIBILITY TensorFlowFusionOpParser : public TensorFlowOpParse | |||
| * @return SUCCESS Parsing success | |||
| * @return FAILED Parsing failed | |||
| */ | |||
| virtual Status ParseParams(const std::vector<const NodeDef *> &v_input_const, ge::NodePtr &node) const; | |||
| virtual Status ParseParams(const std::vector<const NodeDef *> &v_input_const, ge::NodePtr &op_dest) const; | |||
| /** | |||
| * @ingroup domi_omg | |||
| @@ -54,6 +54,7 @@ | |||
| #include "register/register_utils.h" | |||
| #include "register/scope/scope_pass_registry_impl.h" | |||
| #include "parser/common/auto_mapping_subgraph_io_index_func.h" | |||
| #include "graph/def_types.h" | |||
| using ge::OpParserFactory; | |||
| using ge::Pb2Json; | |||
| @@ -1375,7 +1376,7 @@ Status TensorFlowModelParser::Parse(const char *model_path, ge::ComputeGraphPtr | |||
| } | |||
| } | |||
| std::map<std::string, domi::tensorflow::GraphDef>::const_iterator | |||
| const std::map<std::string, domi::tensorflow::GraphDef>::const_iterator | |||
| iter = function_name_to_graphdef.find(arg.function_name); | |||
| if (iter == function_name_to_graphdef.end()) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E12013", {"functionname"}, {arg.function_name}); | |||
| @@ -1868,7 +1869,7 @@ Status TensorFlowModelParser::UpdateAllNodeOpContext(shared_ptr<ge::ScopeGraph> | |||
| ge::ScopeFusionOpInfo info; | |||
| if (IsFusionOpChild(op_node_name, &info) && nodedef_map_[op_node_name]->op() != TENSORFLOWF_NODE_OP_CONST) { | |||
| // This node is a fusion operator | |||
| std::map<std::string, OpNodeContext>::const_iterator | |||
| const std::map<std::string, OpNodeContext>::const_iterator | |||
| fusion_iter = tmp_fusion_op_node_context_map.find(info.fusion_node_name); | |||
| if (fusion_iter == tmp_fusion_op_node_context_map.end()) { | |||
| OpNodeContext op_node_context; | |||
| @@ -2119,7 +2120,7 @@ Status TensorFlowModelParser::NormalizeInputOrOutputMap( | |||
| } | |||
| string name = to_string(pair.first) + ":" + to_string(pair.second); | |||
| std::set<std::string>::const_iterator compare_iter = compare_set.find(name); | |||
| const std::set<std::string>::const_iterator compare_iter = compare_set.find(name); | |||
| if (compare_iter != compare_set.end()) { | |||
| // pair<from,to> repeat, ignore | |||
| continue; | |||
| @@ -2158,7 +2159,7 @@ void TensorFlowModelParser::SaveEdgesControlInfo(const string &node_name, const | |||
| } | |||
| void TensorFlowModelParser::UpdateEdgesControlInfo(const ge::ScopeFusionOpInfo &info) { | |||
| std::map<std::string, std::vector<int32_t>>::const_iterator iter = edges_control_map.find(info.node_name); | |||
| const std::map<std::string, std::vector<int32_t>>::const_iterator iter = edges_control_map.find(info.node_name); | |||
| if (iter != edges_control_map.end()) { | |||
| // Delete the original fusion operator node information and add the fusion operator control edge information | |||
| edges_control_map.erase(iter); | |||
| @@ -2415,7 +2416,7 @@ Status TensorFlowModelParser::ParseProto(const std::string &serialized_proto, ge | |||
| GELOGE(FAILED, "Proto object GraphDef parse serialized proto failed"); | |||
| return FAILED; | |||
| } | |||
| return ParseProto(reinterpret_cast<const google::protobuf::Message *>(&graph_def), graph); | |||
| return ParseProto(ge::PtrToPtr<domi::tensorflow::GraphDef, const google::protobuf::Message>(&graph_def), graph); | |||
| } | |||
| Status TensorFlowModelParser::ParseProtoWithSubgraph(const std::string &root_proto, domi::GetGraphCallbackV2 callback, | |||
| @@ -2482,7 +2483,7 @@ Status TensorFlowModelParser::OptimizeIdentityByOutput(map<string, NodeDef *> &n | |||
| return INTERNAL_ERROR, "Can't find op node context."); | |||
| OpNodeContext op_node_context = context_iter->second; | |||
| std::map<std::string, NodeDef *>::const_iterator node_def_iter = nodedef_map.find(curr_node_name); | |||
| const std::map<std::string, NodeDef *>::const_iterator node_def_iter = nodedef_map.find(curr_node_name); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( | |||
| (node_def_iter == nodedef_map.end()), | |||
| REPORT_INNER_ERROR("E19999", "Node:%s can't find in nodedef_map, check invalid", curr_node_name.c_str()); | |||
| @@ -2506,7 +2507,8 @@ Status TensorFlowModelParser::OptimizeIdentityByOutput(map<string, NodeDef *> &n | |||
| // Deal with non _Retval output operator of Identity. | |||
| if (has_out_retval) { | |||
| for (auto output_iter = output_map.begin(); output_iter != output_map.end(); ++output_iter) { | |||
| std::map<std::string, std::vector<std::pair<int32_t, int32_t>>>::const_iterator output_iter = output_map.begin(); | |||
| for (; output_iter != output_map.end(); ++output_iter) { | |||
| const string &output_node_name = output_iter->first; | |||
| domi::tensorflow::NodeDef *output_node_def = nodedef_map[output_node_name]; | |||
| GE_CHECK_NOTNULL(output_node_def); | |||
| @@ -3902,7 +3904,7 @@ Status TensorFlowModelParser::AddFusionNodeDef(shared_ptr<ge::ScopeGraph> &scope | |||
| DumpAllNodeContext("BeforeAddFusionNodeDef"); | |||
| for (size_t i = 0; i < op_node_list_size; ++i) { | |||
| const string op_node_name = node_name_list[i]; | |||
| auto iter = fusion_op_nodedef_map_.find(op_node_name); | |||
| std::map<string, vector<const NodeDef *>>::const_iterator iter = fusion_op_nodedef_map_.find(op_node_name); | |||
| if (iter != fusion_op_nodedef_map_.end()) { | |||
| vector<string> fusion_op_info = fusion_op_type_map_[op_node_name]; | |||
| if (fusion_op_info[0] != ge::kScopeToMultiNodes) { | |||
| @@ -4059,7 +4061,7 @@ Status TensorFlowModelParser::AddExternalGraph(const ComputeGraphPtr &root_graph | |||
| std::string model_data; | |||
| if (AttrUtils::GetStr(node->GetOpDesc(), kExternalModel, model_data) && !model_data.empty()) { | |||
| ge::Model model; | |||
| auto load_ret = ge::Model::Load(reinterpret_cast<const uint8_t *>(model_data.data()), model_data.size(), model); | |||
| auto load_ret = ge::Model::Load(ge::PtrToPtr<char_t, const uint8_t>(model_data.data()), model_data.size(), model); | |||
| if (load_ret != GRAPH_SUCCESS) { | |||
| GELOGE(INTERNAL_ERROR, "[Parse][ExternalModel]Node:%s.", node->GetName().c_str()); | |||
| REPORT_CALL_ERROR("E19999", "Failed to parse external model, node:%s.", node->GetName().c_str()); | |||
| @@ -130,7 +130,7 @@ class PARSER_FUNC_VISIBILITY TensorFlowModelParser : public domi::ModelParser { | |||
| Status ParseProtoWithSubgraph(const google::protobuf::Message *root_proto, | |||
| domi::GetGraphCallback callback, | |||
| ge::ComputeGraphPtr &graph) override; | |||
| ge::ComputeGraphPtr &root_graph) override; | |||
| /* | |||
| * @ingroup domi_omg | |||
| @@ -34,7 +34,7 @@ class PARSER_FUNC_VISIBILITY TensorFlowReshapeParser : public TensorFlowOpParser | |||
| * @return FAILED parse failed | |||
| * @author | |||
| */ | |||
| Status ParseParams(const Message *op_src, ge::OpDescPtr &op_dest) override; | |||
| Status ParseParams(const Message *op_src, ge::OpDescPtr &op) override; | |||
| }; | |||
| } // namespace ge | |||
| @@ -22,7 +22,7 @@ | |||
| namespace ge { | |||
| class PARSER_FUNC_VISIBILITY TensorFlowSqueezeParser : public TensorFlowOpParser { | |||
| public: | |||
| Status ParseParams(const Message *op_src, ge::OpDescPtr &op_dest) override; | |||
| Status ParseParams(const Message *op_src, ge::OpDescPtr &op) override; | |||
| private: | |||
| static Status ParseDesc(const domi::tensorflow::AttrValue &attr_value, ge::GeTensorDesc &ge_desc); | |||