Merge pull request !236 from wangjiming/developmentpull/236/MERGE
@@ -17,7 +17,6 @@ | |||||
#include "parser/caffe/caffe_custom_parser_adapter.h" | #include "parser/caffe/caffe_custom_parser_adapter.h" | ||||
#include <memory> | #include <memory> | ||||
#include <vector> | #include <vector> | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
@@ -17,7 +17,6 @@ | |||||
#include "parser/caffe/caffe_data_parser.h" | #include "parser/caffe/caffe_data_parser.h" | ||||
#include <unordered_map> | #include <unordered_map> | ||||
#include <utility> | #include <utility> | ||||
#include "common/debug/log.h" | |||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "common/util/error_manager/error_manager.h" | #include "common/util/error_manager/error_manager.h" | ||||
@@ -22,17 +22,14 @@ | |||||
#include <memory> | #include <memory> | ||||
#include <algorithm> | #include <algorithm> | ||||
#include "parser/common/convert/pb2json.h" | #include "parser/common/convert/pb2json.h" | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/op_map.h" | #include "common/op_map.h" | ||||
#include "common/util/error_manager/error_manager.h" | #include "common/util/error_manager/error_manager.h" | ||||
#include "common/ge_types.h" | |||||
#include "common/string_util.h" | #include "common/string_util.h" | ||||
#include "external/graph/operator_factory.h" | #include "external/graph/operator_factory.h" | ||||
#include "external/parser/caffe_parser.h" | #include "external/parser/caffe_parser.h" | ||||
#include "external/ge/ge_api_types.h" | #include "external/ge/ge_api_types.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "graph/optimize/common/params.h" | |||||
#include "graph/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||
#include <google/protobuf/compiler/importer.h> | #include <google/protobuf/compiler/importer.h> | ||||
#include <google/protobuf/descriptor.h> | #include <google/protobuf/descriptor.h> | ||||
@@ -52,6 +49,7 @@ | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "parser/common/proto_file_parser.h" | #include "parser/common/proto_file_parser.h" | ||||
#include "register/op_registry.h" | #include "register/op_registry.h" | ||||
#include "register/register_fmk_types.h" | |||||
using domi::caffe::LayerParameter; | using domi::caffe::LayerParameter; | ||||
using domi::caffe::NetParameter; | using domi::caffe::NetParameter; | ||||
@@ -79,7 +77,7 @@ graphStatus aclgrphParseCaffe(const char *model_file, const char *weights_file, | |||||
GE_CHECK_NOTNULL(model_file); | GE_CHECK_NOTNULL(model_file); | ||||
GetParserContext().type = domi::CAFFE; | GetParserContext().type = domi::CAFFE; | ||||
std::map<string, string> options; | std::map<string, string> options; | ||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(ge::CAFFE))); | |||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(domi::CAFFE))); | |||||
// load custom plugin so and proto | // load custom plugin so and proto | ||||
AclGrphParseUtil acl_graph_parse_util; | AclGrphParseUtil acl_graph_parse_util; | ||||
@@ -126,7 +124,7 @@ graphStatus aclgrphParseCaffe(const char *model_file, const char *weights_file, | |||||
GE_CHECK_NOTNULL(model_file); | GE_CHECK_NOTNULL(model_file); | ||||
GetParserContext().type = domi::CAFFE; | GetParserContext().type = domi::CAFFE; | ||||
std::map<string, string> options; | std::map<string, string> options; | ||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(ge::CAFFE))); | |||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(domi::CAFFE))); | |||||
// load custom plugin so and proto | // load custom plugin so and proto | ||||
AclGrphParseUtil acl_graph_parse_util; | AclGrphParseUtil acl_graph_parse_util; | ||||
@@ -273,7 +271,7 @@ Status CaffeModelParser::ParseInput(domi::caffe::NetParameter &proto_message, bo | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E11002"); | ErrorManager::GetInstance().ATCReportErrMessage("E11002"); | ||||
return PARAM_INVALID, "Model has no input."); | return PARAM_INVALID, "Model has no input."); | ||||
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((input_dim_size / proto_message.input_size() != ge::DIM_DEFAULT_SIZE || | |||||
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((input_dim_size / proto_message.input_size() != parser::DIM_DEFAULT_SIZE || | |||||
input_dim_size % proto_message.input_size() != 0), | input_dim_size % proto_message.input_size() != 0), | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E11003", {"input_dim_size", "input_size"}, | "E11003", {"input_dim_size", "input_size"}, | ||||
@@ -293,9 +291,9 @@ Status CaffeModelParser::ParseInput(domi::caffe::NetParameter &proto_message, bo | |||||
domi::caffe::BlobShape *shape = input_param->add_shape(); | domi::caffe::BlobShape *shape = input_param->add_shape(); | ||||
GE_CHECK_NOTNULL(shape); | GE_CHECK_NOTNULL(shape); | ||||
for (int j = 0; j < ge::DIM_DEFAULT_SIZE; j++) { | |||||
for (int j = 0; j < parser::DIM_DEFAULT_SIZE; j++) { | |||||
// Can guarantee that it will not cross the border | // Can guarantee that it will not cross the border | ||||
shape->add_dim(static_cast<int64_t>(proto_message.input_dim(j + i * ge::DIM_DEFAULT_SIZE))); | |||||
shape->add_dim(static_cast<int64_t>(proto_message.input_dim(j + i * parser::DIM_DEFAULT_SIZE))); | |||||
} | } | ||||
input_data_flag = true; | input_data_flag = true; | ||||
} | } | ||||
@@ -16,9 +16,7 @@ | |||||
#include "parser/caffe/caffe_reshape_parser.h" | #include "parser/caffe/caffe_reshape_parser.h" | ||||
#include <vector> | #include <vector> | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/op/op_parser_util.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/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||
@@ -33,6 +31,8 @@ namespace ge { | |||||
namespace { | namespace { | ||||
const int kAnchorIndexZero = 0; | const int kAnchorIndexZero = 0; | ||||
const int kAnchorIndexOne = 1; | const int kAnchorIndexOne = 1; | ||||
const int32_t RESHAPE_AXIS_DEFAULT_VALUE = 0; | |||||
const int32_t RESHAPE_NUM_AXES_DEFAULT_VALUE = -1; | |||||
} // namespace | } // namespace | ||||
Status CaffeReshapeParser::ParseParams(const Message *op_src, ge::OpDescPtr &op) { | Status CaffeReshapeParser::ParseParams(const Message *op_src, ge::OpDescPtr &op) { | ||||
@@ -23,10 +23,7 @@ | |||||
#include <ctime> | #include <ctime> | ||||
#include <fstream> | #include <fstream> | ||||
#include "common/debug/log.h" | |||||
#include "common/op/ge_op_utils.h" | |||||
#include "common/string_util.h" | #include "common/string_util.h" | ||||
#include "common/types.h" | |||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "common/util/error_manager/error_manager.h" | #include "common/util/error_manager/error_manager.h" | ||||
#include "external/ge/ge_api_types.h" | #include "external/ge/ge_api_types.h" | ||||
@@ -35,6 +32,7 @@ | |||||
#include "ge/ge_api_types.h" | #include "ge/ge_api_types.h" | ||||
#include "google/protobuf/io/coded_stream.h" | #include "google/protobuf/io/coded_stream.h" | ||||
#include "google/protobuf/io/zero_copy_stream_impl.h" | #include "google/protobuf/io/zero_copy_stream_impl.h" | ||||
#include "graph/debug/ge_attr_define.h" | |||||
#include "graph/opsproto_manager.h" | #include "graph/opsproto_manager.h" | ||||
#include "graph/utils/type_utils.h" | #include "graph/utils/type_utils.h" | ||||
#include "omg/parser/parser_inner_ctx.h" | #include "omg/parser/parser_inner_ctx.h" | ||||
@@ -16,12 +16,11 @@ | |||||
#include "parser/common/data_op_parser.h" | #include "parser/common/data_op_parser.h" | ||||
#include <cstdlib> | #include <cstdlib> | ||||
#include "common/debug/log.h" | |||||
#include "common/op/ge_op_utils.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "omg/parser/parser_inner_ctx.h" | |||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "graph/debug/ge_attr_define.h" | |||||
#include "graph/utils/type_utils.h" | #include "graph/utils/type_utils.h" | ||||
#include "omg/omg.h" | |||||
namespace { | namespace { | ||||
const int kDataMemAlignSize = 32; | const int kDataMemAlignSize = 32; | ||||
@@ -19,11 +19,10 @@ | |||||
#include <google/protobuf/text_format.h> | #include <google/protobuf/text_format.h> | ||||
#include <vector> | #include <vector> | ||||
#include "common/debug/log.h" | |||||
#include "common/op/attr_value_util.h" | |||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "omg/omg_inner_types.h" | #include "omg/omg_inner_types.h" | ||||
#include "proto/om.pb.h" | #include "proto/om.pb.h" | ||||
#include "ge/ge_api_error_codes.h" | |||||
#include "graph/attr_value.h" | #include "graph/attr_value.h" | ||||
#include "graph/compute_graph.h" | #include "graph/compute_graph.h" | ||||
@@ -0,0 +1,48 @@ | |||||
/** | |||||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||||
* you may not use this file except in compliance with the License. | |||||
* You may obtain a copy of the License at | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | |||||
* distributed under the License is distributed on an "AS IS" BASIS, | |||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
* See the License for the specific language governing permissions and | |||||
* limitations under the License. | |||||
*/ | |||||
#ifndef PARSER_COMMON_GRAPH_PASS_H_ | |||||
#define PARSER_COMMON_GRAPH_PASS_H_ | |||||
#include <string> | |||||
#include <vector> | |||||
#include "framework/common/debug/ge_log.h" | |||||
#include "graph/compute_graph.h" | |||||
#include "common/pass.h" | |||||
namespace ge { | |||||
/// | |||||
/// @ingroup domi_omg | |||||
/// @brief graph pass | |||||
/// @author | |||||
/// | |||||
class GraphPass : public Pass<ge::ComputeGraph> { | |||||
public: | |||||
/// | |||||
/// run graph pass | |||||
/// @param [in] graph graph to be optimized | |||||
/// @return SUCCESS optimize successfully | |||||
/// @return NOT_CHANGED not optimized | |||||
/// @return others optimized failed | |||||
/// @author | |||||
/// | |||||
virtual Status Run(ge::ComputeGraphPtr graph) = 0; | |||||
virtual Status ClearStatus() { return SUCCESS; }; | |||||
}; | |||||
} // namespace ge | |||||
#endif // PARSER_COMMON_GRAPH_PASS_H_ |
@@ -19,7 +19,7 @@ | |||||
#include "parser/common/model_saver.h" | #include "parser/common/model_saver.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/debug/log.h" | |||||
#include "common/util.h" | |||||
#include "common/util/error_manager/error_manager.h" | #include "common/util/error_manager/error_manager.h" | ||||
#include "mmpa/mmpa_api.h" | #include "mmpa/mmpa_api.h" | ||||
@@ -24,7 +24,7 @@ | |||||
#include "graph/buffer.h" | #include "graph/buffer.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "framework/common/util.h" | |||||
#include "common/util.h" | |||||
namespace ge { | namespace ge { | ||||
static void ConvertList(const std::pair<std::string, OpAttribute> &op_attr_pair, ge::OpDescPtr op_def) { | static void ConvertList(const std::pair<std::string, OpAttribute> &op_attr_pair, ge::OpDescPtr op_def) { | ||||
@@ -18,7 +18,6 @@ | |||||
#include <iostream> | #include <iostream> | ||||
#include <utility> | #include <utility> | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/debug/log.h" | |||||
namespace ge { | namespace ge { | ||||
OpSchema::FormalParameter::FormalParameter(const std::string &name, FormalParameterOption param_option) | OpSchema::FormalParameter::FormalParameter(const std::string &name, FormalParameterOption param_option) | ||||
@@ -17,7 +17,7 @@ | |||||
#include "operator.h" | #include "operator.h" | ||||
#include <utility> | #include <utility> | ||||
#include "framework/common/fmk_types.h" | #include "framework/common/fmk_types.h" | ||||
#include "framework/common/util.h" | |||||
#include "common/util.h" | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
using ge::BoolTuple; | using ge::BoolTuple; | ||||
@@ -15,7 +15,6 @@ | |||||
*/ | */ | ||||
#include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
#include "common/debug/log.h" | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "graph/utils/type_utils.h" | #include "graph/utils/type_utils.h" | ||||
@@ -0,0 +1,62 @@ | |||||
/** | |||||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||||
* you may not use this file except in compliance with the License. | |||||
* You may obtain a copy of the License at | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | |||||
* distributed under the License is distributed on an "AS IS" BASIS, | |||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
* See the License for the specific language governing permissions and | |||||
* limitations under the License. | |||||
*/ | |||||
#ifndef PARSER_COMMON_OP_TYPES_H_ | |||||
#define PARSER_COMMON_OP_TYPES_H_ | |||||
#include <set> | |||||
#include <string> | |||||
namespace ge { | |||||
class GE_FUNC_VISIBILITY OpTypeContainer { | |||||
public: | |||||
static OpTypeContainer *Instance() { | |||||
static OpTypeContainer instance; | |||||
return &instance; | |||||
} | |||||
~OpTypeContainer() = default; | |||||
void Register(const std::string &op_type) { op_type_list_.insert(op_type); } | |||||
bool IsExisting(const std::string &op_type) { | |||||
auto iter_find = op_type_list_.find(op_type); | |||||
return iter_find != op_type_list_.end(); | |||||
} | |||||
protected: | |||||
OpTypeContainer() {} | |||||
private: | |||||
std::set<std::string> op_type_list_; | |||||
}; | |||||
class GE_FUNC_VISIBILITY OpTypeRegistrar { | |||||
public: | |||||
explicit OpTypeRegistrar(const std::string &op_type) { OpTypeContainer::Instance()->Register(op_type); } | |||||
~OpTypeRegistrar() {} | |||||
}; | |||||
#define REGISTER_OPTYPE_DECLARE(var_name, str_name) \ | |||||
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *var_name; | |||||
#define REGISTER_OPTYPE_DEFINE(var_name, str_name) \ | |||||
const char *var_name = str_name; \ | |||||
const OpTypeRegistrar g_##var_name##_reg(str_name); | |||||
#define IS_OPTYPE_EXISTING(str_name) (OpTypeContainer::Instance()->IsExisting(str_name)) | |||||
} // namespace ge | |||||
#endif // PARSER_COMMON_OP_TYPES_H_ |
@@ -15,8 +15,8 @@ | |||||
*/ | */ | ||||
#include "framework/omg/parser/parser_api.h" | #include "framework/omg/parser/parser_api.h" | ||||
#include "common/debug/log.h" | |||||
#include "common/util.h" | |||||
#include "tbe_plugin_loader.h" | #include "tbe_plugin_loader.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "parser/common/register_tbe.h" | #include "parser/common/register_tbe.h" | ||||
@@ -15,7 +15,6 @@ | |||||
*/ | */ | ||||
#include "omg/parser/parser_factory.h" | #include "omg/parser/parser_factory.h" | ||||
#include "common/debug/log.h" | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
namespace domi { | namespace domi { | ||||
@@ -17,7 +17,7 @@ | |||||
#include "parser_utils.h" | #include "parser_utils.h" | ||||
#include "external/ge/ge_api_types.h" | #include "external/ge/ge_api_types.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/util.h" | |||||
#include "common/util.h" | |||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "graph/anchor.h" | #include "graph/anchor.h" | ||||
#include "graph/compute_graph.h" | #include "graph/compute_graph.h" | ||||
@@ -0,0 +1,42 @@ | |||||
/** | |||||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||||
* you may not use this file except in compliance with the License. | |||||
* You may obtain a copy of the License at | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | |||||
* distributed under the License is distributed on an "AS IS" BASIS, | |||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
* See the License for the specific language governing permissions and | |||||
* limitations under the License. | |||||
*/ | |||||
#ifndef PARSER_COMMON_PASS_H_ | |||||
#define PARSER_COMMON_PASS_H_ | |||||
#include <memory> | |||||
#include "common/fmk_error_codes.h" | |||||
namespace ge { | |||||
/// | |||||
/// @ingroup domi_omg | |||||
/// @brief pass | |||||
/// @author | |||||
/// | |||||
template <typename T> | |||||
class Pass { | |||||
public: | |||||
virtual ~Pass() {} | |||||
/// | |||||
/// run pass | |||||
/// @author | |||||
/// | |||||
virtual Status Run(std::shared_ptr<T>) = 0; | |||||
}; | |||||
} // namespace ge | |||||
#endif // PARSER_COMMON_PASS_H_ |
@@ -14,10 +14,10 @@ | |||||
* limitations under the License. | * limitations under the License. | ||||
*/ | */ | ||||
#include "common/util.h" | |||||
#include "parser/common/pass_manager.h" | #include "parser/common/pass_manager.h" | ||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/debug/log.h" | |||||
#include "graph/utils/node_utils.h" | #include "graph/utils/node_utils.h" | ||||
#include "omg/omg_inner_types.h" | #include "omg/omg_inner_types.h" | ||||
@@ -19,7 +19,7 @@ | |||||
#include <vector> | #include <vector> | ||||
#include "inc/graph_pass.h" | |||||
#include "common/graph_pass.h" | |||||
using std::vector; | using std::vector; | ||||
@@ -21,9 +21,9 @@ | |||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "common/util/error_manager/error_manager.h" | #include "common/util/error_manager/error_manager.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "omg/omg.h" | |||||
#include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
#include "parser/common/model_saver.h" | #include "parser/common/model_saver.h" | ||||
#include "omg/parser/parser_inner_ctx.h" | |||||
#include "register/op_registry.h" | #include "register/op_registry.h" | ||||
namespace ge { | namespace ge { | ||||
@@ -24,9 +24,7 @@ | |||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include "common/string_util.h" | #include "common/string_util.h" | ||||
#include "common/types.h" | |||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "ge/ge_api_types.h" | #include "ge/ge_api_types.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
@@ -19,7 +19,6 @@ | |||||
#include <map> | #include <map> | ||||
#include <string> | #include <string> | ||||
#include "common/types.h" | |||||
#include "ge/ge_api_types.h" | #include "ge/ge_api_types.h" | ||||
namespace ge { | namespace ge { | ||||
@@ -18,9 +18,7 @@ | |||||
#include <map> | #include <map> | ||||
#include <memory> | #include <memory> | ||||
#include <string> | #include <string> | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/op/ge_op_utils.h" | |||||
#include "common/op_map.h" | #include "common/op_map.h" | ||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
@@ -23,7 +23,7 @@ | |||||
#include <type_traits> | #include <type_traits> | ||||
#include <utility> | #include <utility> | ||||
#include <vector> | #include <vector> | ||||
#include "framework/common/debug/log.h" | |||||
#include "framework/common/debug/ge_log.h" | |||||
namespace ge { | namespace ge { | ||||
template <typename ValueType> | template <typename ValueType> | ||||
@@ -0,0 +1,248 @@ | |||||
/** | |||||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||||
* you may not use this file except in compliance with the License. | |||||
* You may obtain a copy of the License at | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | |||||
* distributed under the License is distributed on an "AS IS" BASIS, | |||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
* See the License for the specific language governing permissions and | |||||
* limitations under the License. | |||||
*/ | |||||
#ifndef PARSER_COMMON_UTIL_H_ | |||||
#define PARSER_COMMON_UTIL_H_ | |||||
#include "framework/common/debug/ge_log.h" | |||||
#include "mmpa/mmpa_api.h" | |||||
#define CHECK_FALSE_EXEC(expr, exec_expr, ...) \ | |||||
{ \ | |||||
bool b = (expr); \ | |||||
if (!b) { \ | |||||
exec_expr; \ | |||||
} \ | |||||
} | |||||
// For propagating errors when calling a function. | |||||
#define GE_RETURN_IF_ERROR(expr) \ | |||||
do { \ | |||||
const ::ge::Status _status = (expr); \ | |||||
if (_status) return _status; \ | |||||
} while (0) | |||||
#define GE_RETURN_WITH_LOG_IF_ERROR(expr, ...) \ | |||||
do { \ | |||||
const ::ge::Status _status = (expr); \ | |||||
if (_status) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
return _status; \ | |||||
} \ | |||||
} while (0) | |||||
// check whether the parameter is true. If it is, return FAILED and record the error log | |||||
#define GE_RETURN_WITH_LOG_IF_TRUE(condition, ...) \ | |||||
do { \ | |||||
if (condition) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
return ge::FAILED; \ | |||||
} \ | |||||
} while (0) | |||||
// Check if the parameter is false. If yes, return FAILED and record the error log | |||||
#define GE_RETURN_WITH_LOG_IF_FALSE(condition, ...) \ | |||||
do { \ | |||||
bool _condition = (condition); \ | |||||
if (!_condition) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
return ge::FAILED; \ | |||||
} \ | |||||
} while (0) | |||||
// Check if the parameter is false. If yes, return PARAM_INVALID and record the error log | |||||
#define GE_RT_PARAM_INVALID_WITH_LOG_IF_FALSE(condition, ...) \ | |||||
do { \ | |||||
bool _condition = (condition); \ | |||||
if (!_condition) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
return ge::PARAM_INVALID; \ | |||||
} \ | |||||
} while (0) | |||||
// Check if the parameter is null. If yes, return PARAM_INVALID and record the error | |||||
#define GE_CHECK_NOTNULL(val) \ | |||||
do { \ | |||||
if (val == nullptr) { \ | |||||
GELOGE(ge::FAILED, "param[%s] must not be null.", #val); \ | |||||
return ge::PARAM_INVALID; \ | |||||
} \ | |||||
} while (0) | |||||
// Check whether the parameter is null. If so, execute the exec_expr expression and record the error log | |||||
#define GE_CHECK_NOTNULL_EXEC(val, exec_expr) \ | |||||
do { \ | |||||
if (val == nullptr) { \ | |||||
GELOGE(ge::FAILED, "param[%s] must not be null.", #val); \ | |||||
exec_expr; \ | |||||
} \ | |||||
} while (0) | |||||
// Check if the value on the left is greater than or equal to the value on the right | |||||
#define GE_CHECK_GE(lhs, rhs) \ | |||||
do { \ | |||||
if (lhs < rhs) { \ | |||||
GELOGE(ge::FAILED, "param[%s] is less than[%s]", #lhs, #rhs); \ | |||||
return ge::PARAM_INVALID; \ | |||||
} \ | |||||
} while (0) | |||||
#define GE_DELETE_NEW_SINGLE(var) \ | |||||
do { \ | |||||
if (var != nullptr) { \ | |||||
delete var; \ | |||||
var = nullptr; \ | |||||
} \ | |||||
} while (0) | |||||
#define GE_DELETE_NEW_ARRAY(var) \ | |||||
do { \ | |||||
if (var != nullptr) { \ | |||||
delete[] var; \ | |||||
var = nullptr; \ | |||||
} \ | |||||
} while (0) | |||||
// If expr is true, execute exec_expr without printing logs | |||||
#define GE_IF_BOOL_EXEC(expr, exec_expr) \ | |||||
{ \ | |||||
if (expr) { \ | |||||
exec_expr; \ | |||||
} \ | |||||
} | |||||
// If expr is not true, print the log and execute a custom statement | |||||
#define GE_CHK_BOOL_TRUE_EXEC_INFO(expr, exec_expr, ...) \ | |||||
{ \ | |||||
bool b = (expr); \ | |||||
if (b) { \ | |||||
GELOGI(__VA_ARGS__); \ | |||||
exec_expr; \ | |||||
} \ | |||||
} | |||||
// If expr is not true, print the log and return the specified status | |||||
#define GE_CHK_BOOL_RET_STATUS(expr, _status, ...) \ | |||||
do { \ | |||||
bool b = (expr); \ | |||||
if (!b) { \ | |||||
GELOGE(_status, __VA_ARGS__); \ | |||||
return _status; \ | |||||
} \ | |||||
} while (0); | |||||
// If expr is not SUCCESS, print the log and execute the expression + return _status | |||||
#define GE_CHK_BOOL_TRUE_EXEC_RET_STATUS(expr, _status, exec_expr, ...) \ | |||||
{ \ | |||||
bool b = (expr); \ | |||||
if (b) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
exec_expr; \ | |||||
return _status; \ | |||||
} \ | |||||
} | |||||
// If expr is not SUCCESS, print the log and return the same value | |||||
#define GE_CHK_STATUS_RET(expr, ...) \ | |||||
do { \ | |||||
const ge::Status _status = (expr); \ | |||||
if (_status != ge::SUCCESS) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
return _status; \ | |||||
} \ | |||||
} while (0); | |||||
// If expr is true, print logs and execute custom statements | |||||
#define GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(expr, exec_expr, ...) \ | |||||
{ \ | |||||
bool b = (expr); \ | |||||
if (b) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
exec_expr; \ | |||||
} \ | |||||
} | |||||
// If expr is not SUCCESS, print the log and do not execute return | |||||
#define GE_CHK_STATUS(expr, ...) \ | |||||
do { \ | |||||
const ge::Status _status = (expr); \ | |||||
if (_status != ge::SUCCESS) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
} \ | |||||
} while (0); | |||||
#define GE_LOGE_IF(condition, ...) \ | |||||
if ((condition)) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
} | |||||
// If expr is not true, print the log and execute a custom statement | |||||
#define GE_CHK_BOOL_EXEC(expr, exec_expr, ...) \ | |||||
{ \ | |||||
bool b = (expr); \ | |||||
if (!b) { \ | |||||
GELOGE(ge::FAILED, __VA_ARGS__); \ | |||||
exec_expr; \ | |||||
} \ | |||||
} | |||||
// ge marco | |||||
#define GE_LOGI_IF(condition, ...) \ | |||||
if ((condition)) { \ | |||||
GELOGI(__VA_ARGS__); \ | |||||
} | |||||
#define GE_LOGW_IF(condition, ...) \ | |||||
if ((condition)) { \ | |||||
GELOGW(__VA_ARGS__); \ | |||||
} | |||||
// If expr is not true, execute a custom statement | |||||
#define GE_CHK_BOOL_EXEC_NOLOG(expr, exec_expr) \ | |||||
{ \ | |||||
bool b = (expr); \ | |||||
if (!b) { \ | |||||
exec_expr; \ | |||||
} \ | |||||
} | |||||
// If expr is not SUCCESS, print the log and execute a custom statement | |||||
#define GE_CHK_STATUS_EXEC(expr, exec_expr, ...) \ | |||||
do { \ | |||||
const ge::Status _status = (expr); \ | |||||
GE_CHK_BOOL_EXEC(_status == SUCCESS, exec_expr, __VA_ARGS__); \ | |||||
} while (0); | |||||
// If expr is not true, print the log and execute a custom statement | |||||
#define GE_CHK_BOOL_EXEC_INFO(expr, exec_expr, ...) \ | |||||
{ \ | |||||
bool b = (expr); \ | |||||
if (!b) { \ | |||||
GELOGI(__VA_ARGS__); \ | |||||
exec_expr; \ | |||||
} \ | |||||
} | |||||
// If make_shared is abnormal, print the log and execute the statement | |||||
#define GE_MAKE_SHARED(exec_expr0, exec_expr1) \ | |||||
try { \ | |||||
exec_expr0; \ | |||||
} catch (const std::bad_alloc &) { \ | |||||
GELOGE(ge::FAILED, "Make shared failed"); \ | |||||
exec_expr1; \ | |||||
} | |||||
#endif // PARSER_COMMON_UTIL_H_ |
@@ -18,7 +18,7 @@ | |||||
#include <map> | #include <map> | ||||
#include <vector> | #include <vector> | ||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/util.h" | |||||
#include "framework/omg/parser/parser_inner_ctx.h" | #include "framework/omg/parser/parser_inner_ctx.h" | ||||
#include "graph/ge_tensor.h" | #include "graph/ge_tensor.h" | ||||
#include "graph/utils/tensor_adapter.h" | #include "graph/utils/tensor_adapter.h" | ||||
@@ -18,6 +18,7 @@ | |||||
#define GE_PARSER_ONNX_ONNX_CONSTANT_PARSER_H_ | #define GE_PARSER_ONNX_ONNX_CONSTANT_PARSER_H_ | ||||
#include <string> | #include <string> | ||||
#include "common/util.h" | |||||
#include "parser/common/data_op_parser.h" | #include "parser/common/data_op_parser.h" | ||||
#include "parser/onnx/onnx_op_parser.h" | #include "parser/onnx/onnx_op_parser.h" | ||||
@@ -17,6 +17,7 @@ | |||||
#include "onnx_data_parser.h" | #include "onnx_data_parser.h" | ||||
#include <unordered_map> | #include <unordered_map> | ||||
#include "common/util.h" | #include "common/util.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_inner_ctx.h" | #include "framework/omg/parser/parser_inner_ctx.h" | ||||
#include "parser/onnx/onnx_util.h" | #include "parser/onnx/onnx_util.h" | ||||
@@ -33,7 +33,6 @@ | |||||
#include <string> | #include <string> | ||||
#include <vector> | #include <vector> | ||||
#include "framework/common/op/attr_value_util.h" | |||||
#include "framework/omg/parser/op_parser.h" | #include "framework/omg/parser/op_parser.h" | ||||
#include "graph/ge_tensor.h" | #include "graph/ge_tensor.h" | ||||
#include "graph/node.h" | #include "graph/node.h" | ||||
@@ -19,7 +19,6 @@ | |||||
#include <iostream> | #include <iostream> | ||||
#include "common/convert/pb2json.h" | #include "common/convert/pb2json.h" | ||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "common/ge_types.h" | |||||
#include "common/util/error_manager/error_manager.h" | #include "common/util/error_manager/error_manager.h" | ||||
#include "external/graph/operator_factory.h" | #include "external/graph/operator_factory.h" | ||||
#include "external/register/register_error_codes.h" | #include "external/register/register_error_codes.h" | ||||
@@ -37,6 +36,7 @@ | |||||
#include "parser/common/parser_utils.h" | #include "parser/common/parser_utils.h" | ||||
#include "parser/onnx/onnx_util.h" | #include "parser/onnx/onnx_util.h" | ||||
#include "register/op_registry.h" | #include "register/op_registry.h" | ||||
#include "register/register_fmk_types.h" | |||||
namespace ge { | namespace ge { | ||||
graphStatus PrepareBeforeParse(AclGrphParseUtil &acl_graph_parse_util, | graphStatus PrepareBeforeParse(AclGrphParseUtil &acl_graph_parse_util, | ||||
@@ -44,7 +44,7 @@ graphStatus PrepareBeforeParse(AclGrphParseUtil &acl_graph_parse_util, | |||||
ge::Graph &graph, std::shared_ptr<domi::ModelParser> &model_parser) { | ge::Graph &graph, std::shared_ptr<domi::ModelParser> &model_parser) { | ||||
GetParserContext().type = domi::ONNX; | GetParserContext().type = domi::ONNX; | ||||
std::map<string, string> options; | std::map<string, string> options; | ||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(ge::ONNX))); | |||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(domi::ONNX))); | |||||
if (acl_graph_parse_util.AclParserInitialize(options) != ge::SUCCESS) { | if (acl_graph_parse_util.AclParserInitialize(options) != ge::SUCCESS) { | ||||
GELOGE(ge::FAILED, "Acl parser initialize failed."); | GELOGE(ge::FAILED, "Acl parser initialize failed."); | ||||
@@ -20,7 +20,6 @@ | |||||
#include <string> | #include <string> | ||||
#include <vector> | #include <vector> | ||||
#include "common/fmk_types.h" | #include "common/fmk_types.h" | ||||
#include "common/op/ge_op_utils.h" | |||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "graph/compute_graph.h" | #include "graph/compute_graph.h" | ||||
#include "graph/node.h" | #include "graph/node.h" | ||||
@@ -22,15 +22,14 @@ | |||||
#include "./graph_insert_trans_op.h" | #include "./graph_insert_trans_op.h" | ||||
#include "cce/cce.h" | #include "cce/cce.h" | ||||
#include "cce/dnn.h" | #include "cce/dnn.h" | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/op/ge_op_utils.h" | |||||
#include "common/op_map.h" | #include "common/op_map.h" | ||||
#include "common/op_types.h" | |||||
#include "common/types_map.h" | #include "common/types_map.h" | ||||
#include "common/util.h" | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/omg/parser/parser_inner_ctx.h" | #include "framework/omg/parser/parser_inner_ctx.h" | ||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "graph/common/omg_util.h" | |||||
#include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
#include "graph/ge_tensor.h" | #include "graph/ge_tensor.h" | ||||
#include "graph/types.h" | #include "graph/types.h" | ||||
@@ -70,7 +69,6 @@ using ge::local_framework_op_vec; | |||||
using ge::NodePtr; | using ge::NodePtr; | ||||
using ge::OpDesc; | using ge::OpDesc; | ||||
using ge::OpDescPtr; | using ge::OpDescPtr; | ||||
using ge::OpUtils; | |||||
using ge::OutControlAnchorPtr; | using ge::OutControlAnchorPtr; | ||||
using ge::OutDataAnchorPtr; | using ge::OutDataAnchorPtr; | ||||
using ge::TensorUtils; | using ge::TensorUtils; | ||||
@@ -18,7 +18,6 @@ | |||||
#include <memory> | #include <memory> | ||||
#include "common/debug/log.h" | |||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "graph_optimizer.h" | #include "graph_optimizer.h" | ||||
@@ -17,13 +17,13 @@ | |||||
#ifndef GE_GRAPH_PASSES_ITERATOR_FUSION_PASS_H_ | #ifndef GE_GRAPH_PASSES_ITERATOR_FUSION_PASS_H_ | ||||
#define GE_GRAPH_PASSES_ITERATOR_FUSION_PASS_H_ | #define GE_GRAPH_PASSES_ITERATOR_FUSION_PASS_H_ | ||||
#include "framework/common/ge_types.h" | |||||
#include "inc/graph_pass.h" | |||||
#include "common/graph_pass.h" | |||||
#include "register/register_fmk_types.h" | |||||
namespace ge { | namespace ge { | ||||
class IteratorFusionPass : public GraphPass { | class IteratorFusionPass : public GraphPass { | ||||
public: | public: | ||||
IteratorFusionPass(ge::FrameworkType type, bool local_fmk_op_flag) | |||||
IteratorFusionPass(domi::FrameworkType type, bool local_fmk_op_flag) | |||||
: fmk_type_(type), local_fmk_op_flag_(local_fmk_op_flag) {} | : fmk_type_(type), local_fmk_op_flag_(local_fmk_op_flag) {} | ||||
virtual ~IteratorFusionPass() {} | virtual ~IteratorFusionPass() {} | ||||
@@ -31,7 +31,7 @@ class IteratorFusionPass : public GraphPass { | |||||
Status Run(ge::ComputeGraphPtr graph) final; | Status Run(ge::ComputeGraphPtr graph) final; | ||||
private: | private: | ||||
ge::FrameworkType fmk_type_; | |||||
domi::FrameworkType fmk_type_; | |||||
bool local_fmk_op_flag_; | bool local_fmk_op_flag_; | ||||
}; | }; | ||||
} // namespace ge | } // namespace ge | ||||
@@ -14,7 +14,6 @@ | |||||
* limitations under the License. | * limitations under the License. | ||||
*/ | */ | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/op_def/arg_op.h" | #include "parser/common/op_def/arg_op.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/omg/parser/parser_inner_ctx.h" | #include "framework/omg/parser/parser_inner_ctx.h" | ||||
@@ -18,11 +18,10 @@ | |||||
#include <map> | #include <map> | ||||
#include <memory> | #include <memory> | ||||
#include <vector> | #include <vector> | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/op/ge_op_utils.h" | |||||
#include "parser/common/op_def/constant_op.h" | #include "parser/common/op_def/constant_op.h" | ||||
#include "parser/common/op_def/ir_pb_converter.h" | #include "parser/common/op_def/ir_pb_converter.h" | ||||
#include "parser/common/util.h" | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "graph/ge_tensor.h" | #include "graph/ge_tensor.h" | ||||
#include "graph/utils/attr_utils.h" | #include "graph/utils/attr_utils.h" | ||||
@@ -16,7 +16,6 @@ | |||||
#include "parser/tensorflow/tensorflow_data_parser.h" | #include "parser/tensorflow/tensorflow_data_parser.h" | ||||
#include <unordered_map> | #include <unordered_map> | ||||
#include "common/debug/log.h" | |||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/omg/parser/parser_inner_ctx.h" | #include "framework/omg/parser/parser_inner_ctx.h" | ||||
@@ -16,7 +16,7 @@ | |||||
#include "parser/tensorflow/tensorflow_enter_parser.h" | #include "parser/tensorflow/tensorflow_enter_parser.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/debug/log.h" | |||||
#include "common/util.h" | |||||
#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" | ||||
@@ -14,11 +14,7 @@ | |||||
* limitations under the License. | * limitations under the License. | ||||
*/ | */ | ||||
// Copyright (c) <2018>, <Huawei Technologies Co., Ltd> | |||||
#include "common/debug/log.h" | |||||
#include "common/op/attr_value_util.h" | |||||
#include "parser/common/op_def/fill_op.h" | #include "parser/common/op_def/fill_op.h" | ||||
#include "common/util.h" | |||||
#include "parser/tensorflow/tensorflow_parser_register.h" | #include "parser/tensorflow/tensorflow_parser_register.h" | ||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
@@ -14,7 +14,6 @@ | |||||
* limitations under the License. | * limitations under the License. | ||||
*/ | */ | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/op_def/frameworkop_op.h" | #include "parser/common/op_def/frameworkop_op.h" | ||||
#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" | ||||
@@ -16,11 +16,9 @@ | |||||
#include "parser/tensorflow/tensorflow_fusion_op_parser.h" | #include "parser/tensorflow/tensorflow_fusion_op_parser.h" | ||||
#include <memory> | #include <memory> | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/util.h" | #include "common/util.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "omg/omg.h" | |||||
#include "parser/common/parser_fp16_t.h" | #include "parser/common/parser_fp16_t.h" | ||||
#include "parser/tensorflow/tensorflow_op_parser.h" | #include "parser/tensorflow/tensorflow_op_parser.h" | ||||
#include "register/tensor_assign.h" | #include "register/tensor_assign.h" | ||||
@@ -18,7 +18,6 @@ | |||||
#define OMG_PARSER_TENSORFLOW_TENSORFLOW_FUSION_OP_PARSER_H_ | #define OMG_PARSER_TENSORFLOW_TENSORFLOW_FUSION_OP_PARSER_H_ | ||||
#include <vector> | #include <vector> | ||||
#include "common/op/attr_value_util.h" | |||||
#include "graph/ge_tensor.h" | #include "graph/ge_tensor.h" | ||||
#include "omg/parser/op_parser.h" | #include "omg/parser/op_parser.h" | ||||
#include "parser/tensorflow/tensorflow_fusionop_util.h" | #include "parser/tensorflow/tensorflow_fusionop_util.h" | ||||
@@ -16,9 +16,8 @@ | |||||
#include "parser/tensorflow/tensorflow_fusionop_util.h" | #include "parser/tensorflow/tensorflow_fusionop_util.h" | ||||
#include "common/util/error_manager/error_manager.h" | #include "common/util/error_manager/error_manager.h" | ||||
#include "common/debug/log.h" | |||||
#include "common/op/ge_op_utils.h" | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "parser/common/util.h" | |||||
#include "parser/tensorflow/tensorflow_parser.h" | #include "parser/tensorflow/tensorflow_parser.h" | ||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
@@ -20,10 +20,8 @@ | |||||
#include <string> | #include <string> | ||||
#include <utility> | #include <utility> | ||||
#include <vector> | #include <vector> | ||||
#include "common/debug/log.h" | |||||
#include "common/string_util.h" | #include "common/string_util.h" | ||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "common/util.h" | |||||
#include "omg/omg_inner_types.h" | #include "omg/omg_inner_types.h" | ||||
#include "proto/tensorflow/graph.pb.h" | #include "proto/tensorflow/graph.pb.h" | ||||
#include "external/register/scope/scope_fusion_pass_register.h" | #include "external/register/scope/scope_fusion_pass_register.h" | ||||
@@ -14,7 +14,6 @@ | |||||
* limitations under the License. | * limitations under the License. | ||||
*/ | */ | ||||
#include "common/op/ge_op_utils.h" | |||||
#include "common/op_def/ir_pb_converter.h" | #include "common/op_def/ir_pb_converter.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" | ||||
@@ -17,7 +17,7 @@ | |||||
#include "parser/tensorflow/tensorflow_merge_parser.h" | #include "parser/tensorflow/tensorflow_merge_parser.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/util.h" | |||||
#include "common/util.h" | |||||
#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" | ||||
@@ -15,7 +15,7 @@ | |||||
*/ | */ | ||||
#include "parser/tensorflow/tensorflow_no_op_parser.h" | #include "parser/tensorflow/tensorflow_no_op_parser.h" | ||||
#include "framework/common/util.h" | |||||
#include "common/util.h" | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "parser/common/op_def/ir_pb_converter.h" | #include "parser/common/op_def/ir_pb_converter.h" | ||||
#include "parser/common/op_def/no_op_op.h" | #include "parser/common/op_def/no_op_op.h" | ||||
@@ -33,8 +33,8 @@ | |||||
#include <string> | #include <string> | ||||
#include <vector> | #include <vector> | ||||
#include "framework/common/op/attr_value_util.h" | |||||
#include "framework/omg/parser/op_parser.h" | #include "framework/omg/parser/op_parser.h" | ||||
#include "graph/debug/ge_attr_define.h" | |||||
#include "graph/ge_tensor.h" | #include "graph/ge_tensor.h" | ||||
#include "graph/node.h" | #include "graph/node.h" | ||||
#include "register/tensor_assign.h" | #include "register/tensor_assign.h" | ||||
@@ -17,8 +17,8 @@ | |||||
#include "parser/tensorflow/tensorflow_parser.h" | #include "parser/tensorflow/tensorflow_parser.h" | ||||
#include <algorithm> | #include <algorithm> | ||||
#include <iostream> | #include <iostream> | ||||
#include "ge/ge_api_types.h" | |||||
#include "parser/common/convert/pb2json.h" | #include "parser/common/convert/pb2json.h" | ||||
#include "common/debug/log.h" | |||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "common/util/error_manager/error_manager.h" | #include "common/util/error_manager/error_manager.h" | ||||
#include "external/graph/operator_factory.h" | #include "external/graph/operator_factory.h" | ||||
@@ -28,13 +28,10 @@ | |||||
#include "framework/omg/parser/parser_api.h" | #include "framework/omg/parser/parser_api.h" | ||||
#include "framework/omg/parser/parser_inner_ctx.h" | #include "framework/omg/parser/parser_inner_ctx.h" | ||||
#include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
#include "graph/optimize/common/params.h" | |||||
#include "graph/passes/variable_format_pass.h" | |||||
#include "graph/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||
#include "graph/utils/node_utils.h" | #include "graph/utils/node_utils.h" | ||||
#include "graph/utils/type_utils.h" | #include "graph/utils/type_utils.h" | ||||
#include "iterator_fusion_pass.h" | #include "iterator_fusion_pass.h" | ||||
#include "omg/omg.h" | |||||
#include "omg/parser/op_parser.h" | #include "omg/parser/op_parser.h" | ||||
#include "omg/parser/parser_factory.h" | #include "omg/parser/parser_factory.h" | ||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
@@ -46,6 +43,7 @@ | |||||
#include "parser/common/pre_checker.h" | #include "parser/common/pre_checker.h" | ||||
#include "parser/common/thread_pool.h" | #include "parser/common/thread_pool.h" | ||||
#include "parser/common/parser_utils.h" | #include "parser/common/parser_utils.h" | ||||
#include "parser/common/util.h" | |||||
#include "parser/tensorflow/tensorflow_custom_parser_adapter.h" | #include "parser/tensorflow/tensorflow_custom_parser_adapter.h" | ||||
#include "parser/tensorflow/tensorflow_fusion_custom_parser_adapter.h" | #include "parser/tensorflow/tensorflow_fusion_custom_parser_adapter.h" | ||||
#include "parser/tensorflow/tensorflow_fusion_op_parser.h" | #include "parser/tensorflow/tensorflow_fusion_op_parser.h" | ||||
@@ -93,7 +91,7 @@ graphStatus aclgrphParseTensorFlow(const char *model_file, ge::Graph &graph) { | |||||
GE_CHECK_NOTNULL(model_file); | GE_CHECK_NOTNULL(model_file); | ||||
GetParserContext().type = domi::TENSORFLOW; | GetParserContext().type = domi::TENSORFLOW; | ||||
std::map<string, string> options; | std::map<string, string> options; | ||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(ge::TENSORFLOW))); | |||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(domi::TENSORFLOW))); | |||||
// load custom plugin so and proto | // load custom plugin so and proto | ||||
AclGrphParseUtil acl_graph_parse_util; | AclGrphParseUtil acl_graph_parse_util; | ||||
@@ -132,7 +130,7 @@ graphStatus aclgrphParseTensorFlow(const char *model_file, const std::map<Ascend | |||||
GE_CHECK_NOTNULL(model_file); | GE_CHECK_NOTNULL(model_file); | ||||
GetParserContext().type = domi::TENSORFLOW; | GetParserContext().type = domi::TENSORFLOW; | ||||
std::map<string, string> options; | std::map<string, string> options; | ||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(ge::TENSORFLOW))); | |||||
options.insert(std::pair<string, string>(string(ge::FRAMEWORK_TYPE), to_string(domi::TENSORFLOW))); | |||||
// load custom plugin so and proto | // load custom plugin so and proto | ||||
AclGrphParseUtil acl_graph_parse_util; | AclGrphParseUtil acl_graph_parse_util; | ||||
@@ -2244,7 +2242,7 @@ Status TensorFlowModelParser::ParseProto(const google::protobuf::Message *proto, | |||||
ge::parser::PassManager iterator_fusion_pass; | ge::parser::PassManager iterator_fusion_pass; | ||||
try { | try { | ||||
(void)iterator_fusion_pass.AddPass("ParseProto::IteratorFusionPass", | (void)iterator_fusion_pass.AddPass("ParseProto::IteratorFusionPass", | ||||
new ge::IteratorFusionPass(ge::TENSORFLOW, false)); | |||||
new ge::IteratorFusionPass(domi::TENSORFLOW, false)); | |||||
} catch (std::bad_alloc &e) { | } catch (std::bad_alloc &e) { | ||||
GELOGE(INTERNAL_ERROR, "Add pass failed, bad memory allocation occurs."); | GELOGE(INTERNAL_ERROR, "Add pass failed, bad memory allocation occurs."); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
@@ -2874,7 +2872,8 @@ Status TensorFlowModelParser::GetFormatTranspose(const NodeDef *transpose_node, | |||||
return FAILED); | return FAILED); | ||||
const TensorProto &tensor = attr_value.tensor(); | const TensorProto &tensor = attr_value.tensor(); | ||||
const TensorShapeProto &tensor_shape = tensor.tensor_shape(); | const TensorShapeProto &tensor_shape = tensor.tensor_shape(); | ||||
GE_IF_BOOL_EXEC(tensor_shape.dim_size() != 1 || tensor_shape.dim(0).size() != ge::DIM_DEFAULT_SIZE, return SUCCESS); | |||||
GE_IF_BOOL_EXEC(tensor_shape.dim_size() != 1 || tensor_shape.dim(0).size() != parser::DIM_DEFAULT_SIZE, | |||||
return SUCCESS); | |||||
GE_IF_BOOL_EXEC(tensor.tensor_content().empty(), return SUCCESS); | GE_IF_BOOL_EXEC(tensor.tensor_content().empty(), return SUCCESS); | ||||
vector<int64_t> perm_value; | vector<int64_t> perm_value; | ||||
@@ -2882,12 +2881,12 @@ Status TensorFlowModelParser::GetFormatTranspose(const NodeDef *transpose_node, | |||||
GE_IF_BOOL_EXEC( | GE_IF_BOOL_EXEC( | ||||
type == domi::tensorflow::DT_INT32, | type == domi::tensorflow::DT_INT32, | ||||
const int32_t *data = reinterpret_cast<const int32_t *>(tensor.tensor_content().data()); | const int32_t *data = reinterpret_cast<const int32_t *>(tensor.tensor_content().data()); | ||||
for (int i = 0; i < ge::DIM_DEFAULT_SIZE; i++) { perm_value.push_back(data[i]); }); | |||||
for (int i = 0; i < parser::DIM_DEFAULT_SIZE; i++) { perm_value.push_back(data[i]); }); | |||||
GE_IF_BOOL_EXEC( | GE_IF_BOOL_EXEC( | ||||
type == domi::tensorflow::DT_INT64, | type == domi::tensorflow::DT_INT64, | ||||
const int64_t *data = reinterpret_cast<const int64_t *>(tensor.tensor_content().data()); | const int64_t *data = reinterpret_cast<const int64_t *>(tensor.tensor_content().data()); | ||||
for (int i = 0; i < ge::DIM_DEFAULT_SIZE; i++) { perm_value.push_back(data[i]); }); | |||||
for (int i = 0; i < parser::DIM_DEFAULT_SIZE; i++) { perm_value.push_back(data[i]); }); | |||||
// 0, 1, 2, 3 present dim num. | // 0, 1, 2, 3 present dim num. | ||||
vector<int64_t> perm_to_nchw = {0, 3, 1, 2}; | vector<int64_t> perm_to_nchw = {0, 3, 1, 2}; | ||||
@@ -24,7 +24,6 @@ | |||||
#include <unordered_map> | #include <unordered_map> | ||||
#include <utility> | #include <utility> | ||||
#include <vector> | #include <vector> | ||||
#include "common/op/ge_op_utils.h" | |||||
#include "graph/compute_graph.h" | #include "graph/compute_graph.h" | ||||
#include "graph/ge_attr_value.h" | #include "graph/ge_attr_value.h" | ||||
#include "graph/ge_tensor.h" | #include "graph/ge_tensor.h" | ||||
@@ -21,7 +21,7 @@ | |||||
#include <functional> | #include <functional> | ||||
#include <memory> | #include <memory> | ||||
#include <string> | #include <string> | ||||
#include "framework/common/util.h" | |||||
#include "common/util.h" | |||||
#include "framework/omg/parser/op_parser.h" | #include "framework/omg/parser/op_parser.h" | ||||
#include "parser/common/op_def/ir_pb_converter.h" | #include "parser/common/op_def/ir_pb_converter.h" | ||||
#include "parser/common/op_def/operator.h" | #include "parser/common/op_def/operator.h" | ||||
@@ -16,10 +16,10 @@ | |||||
#include "parser/tensorflow/tensorflow_ref_switch_parser.h" | #include "parser/tensorflow/tensorflow_ref_switch_parser.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/op/ge_op_utils.h" | |||||
#include "parser/common/op_def/ir_pb_converter.h" | #include "parser/common/op_def/ir_pb_converter.h" | ||||
#include "parser/common/op_def/ref_switch_op.h" | #include "parser/common/op_def/ref_switch_op.h" | ||||
#include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
#include "parser/common/util.h" | |||||
using domi::tensorflow::DataType; | using domi::tensorflow::DataType; | ||||
using domi::tensorflow::DT_FLOAT; | using domi::tensorflow::DT_FLOAT; | ||||
@@ -16,13 +16,12 @@ | |||||
#include "parser/tensorflow/tensorflow_reshape_parser.h" | #include "parser/tensorflow/tensorflow_reshape_parser.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/debug/log.h" | |||||
#include "framework/common/op/ge_op_utils.h" | |||||
#include "framework/omg/omg.h" | |||||
#include "graph/utils/type_utils.h" | #include "graph/utils/type_utils.h" | ||||
#include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
#include "parser/common/util.h" | |||||
#include "parser/tensorflow/tensorflow_util.h" | #include "parser/tensorflow/tensorflow_util.h" | ||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "omg/parser/parser_inner_ctx.h" | |||||
using domi::TENSORFLOW; | using domi::TENSORFLOW; | ||||
using namespace ge::parser; | using namespace ge::parser; | ||||
@@ -17,9 +17,9 @@ | |||||
#include "parser/tensorflow/tensorflow_shape_n_parser.h" | #include "parser/tensorflow/tensorflow_shape_n_parser.h" | ||||
#include "parser/common/op_def/ir_pb_converter.h" | #include "parser/common/op_def/ir_pb_converter.h" | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/op/ge_op_utils.h" | |||||
#include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
#include "parser/common/op_def/shape_n_op.h" | #include "parser/common/op_def/shape_n_op.h" | ||||
#include "parser/common/util.h" | |||||
using domi::TENSORFLOW; | using domi::TENSORFLOW; | ||||
using domi::tensorflow::AttrValue; | using domi::tensorflow::AttrValue; | ||||
@@ -18,10 +18,7 @@ | |||||
#include <memory> | #include <memory> | ||||
#include <vector> | #include <vector> | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/debug/log.h" | |||||
#include "framework/common/op/attr_value_util.h" | |||||
#include "framework/common/op/op_parser_util.h" | |||||
#include "framework/common/util.h" | |||||
#include "common/util.h" | |||||
#include "framework/omg/parser/parser_inner_ctx.h" | #include "framework/omg/parser/parser_inner_ctx.h" | ||||
#include "graph/utils/type_utils.h" | #include "graph/utils/type_utils.h" | ||||
#include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
@@ -19,9 +19,9 @@ | |||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <iostream> | #include <iostream> | ||||
#include <memory> | #include <memory> | ||||
#include "common/string_util.h" | |||||
#include "common/util.h" | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/debug/log.h" | |||||
#include "framework/common/op/ge_op_utils.h" | |||||
#include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
#include "graph/debug/ge_attr_define.h" | #include "graph/debug/ge_attr_define.h" | ||||
#include "graph/ge_tensor.h" | #include "graph/ge_tensor.h" | ||||
@@ -15,8 +15,6 @@ | |||||
*/ | */ | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/util.h" | |||||
#include "framework/common/op/ge_op_utils.h" | |||||
#include "parser/common/op_def/var_is_initialized_op_op.h" | #include "parser/common/op_def/var_is_initialized_op_op.h" | ||||
#include "parser/common/op_parser_factory.h" | #include "parser/common/op_parser_factory.h" | ||||
#include "parser/tensorflow/tensorflow_op_parser.h" | #include "parser/tensorflow/tensorflow_op_parser.h" | ||||
@@ -15,8 +15,6 @@ | |||||
*/ | */ | ||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "framework/common/debug/log.h" | |||||
#include "framework/common/op/ge_op_utils.h" | |||||
#include "graph/compute_graph.h" | #include "graph/compute_graph.h" | ||||
#include "graph/ge_attr_value.h" | #include "graph/ge_attr_value.h" | ||||
#include "graph/ge_tensor.h" | #include "graph/ge_tensor.h" | ||||