update ge cmakelist

pull/89/head
taoxiangdong 5 years ago
parent 70fd899356
commit 1f1abf6c63

@ -26,15 +26,17 @@ if (ENABLE_OPEN_SRC)
set(ASCEND_DIR /usr/local/Ascend)
endif()
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64/common)
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64)
set(ASCEND_DRIVER_COMMON_DIR ${ASCEND_DIR}/driver/lib64/common)
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
find_module(slog libslog.so ${ASCEND_DRIVER_DIR})
find_module(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR})
find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
find_module(runtime_compile libruntime_compile.so ${ASCEND_RUNTIME_DIR})
find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR})
find_module(resource libresource.so ${ASCEND_RUNTIME_DIR})
find_module(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR})
@ -44,6 +46,7 @@ if (ENABLE_OPEN_SRC)
set(GE_DEPEND_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
add_subdirectory(metadef)
add_subdirectory(parser)
#add_subdirectory(metadef/graph)
#add_subdirectory(metadef/register)
else()

@ -12,7 +12,7 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
endif()
ExternalProject_Add(gflags_build
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
URL https://github.com/gflags/gflags/archive/v2.2.2.tar.gz
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
SOURCE_DIR ${GE_CODE_DIR}/../third_party/gflags/src/gflags-2.2.2
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/gflags <SOURCE_DIR>

@ -6,7 +6,7 @@ include(ExternalProject)
set(JSON_SRC_DIR ${GE_CODE_DIR}/../third_party/json/include)
ExternalProject_Add(json_build
#URL https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip
URL https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip
#URL /home/txd/workspace/cloud_code/pkg/include.zip
SOURCE_DIR ${JSON_SRC_DIR}
CONFIGURE_COMMAND ""

@ -7,8 +7,8 @@ set(ONNX_PROTO_FILE ${ONNX_PROTO_DIR}/onnx.proto)
file(MAKE_DIRECTORY ${ONNX_PROTO_DIR})
ExternalProject_Add(onnx
#URL https://github.com/onnx/onnx/releases/download/v1.6.0/onnx-1.6.0.tar.gz
URL /home/txd/workspace/cloud_code/pkg/onnx-1.6.0.tar.gz
URL https://github.com/onnx/onnx/releases/download/v1.6.0/onnx-1.6.0.tar.gz
#URL /home/txd/workspace/cloud_code/pkg/onnx-1.6.0.tar.gz
#URL_HASH SHA256=3b88c3fe521151651a0403c4d131cb2e0311bd28b753ef692020a432a81ce345
#SOURCE_DIR ${ONNX_SRC_DIR}
CONFIGURE_COMMAND ""

@ -14,7 +14,7 @@ endif()
set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 $<$<STREQUAL:${PRODUCT_SIDE},host>:-D_GLIBCXX_USE_CXX11_ABI=0> -O2")
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
ExternalProject_Add(protobuf_build
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
#SOURCE_DIR ${GE_CODE_DIR}/third_party/protobuf/src/protobuf-3.8.0
DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0 <SOURCE_DIR>

@ -12,7 +12,7 @@ set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fst
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
set(PROTOBUF_STATIC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf_static)
ExternalProject_Add(protobuf_static_build
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
SOURCE_DIR ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0
CONFIGURE_COMMAND ${CMAKE_COMMAND}

@ -15,7 +15,7 @@ endif()
set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2")
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
ExternalProject_Add(protoc_build
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
SOURCE_DIR ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0
CONFIGURE_COMMAND ${CMAKE_COMMAND} -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/protoc <SOURCE_DIR>/cmake

@ -11,7 +11,7 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
endif()
ExternalProject_Add(c_sec_build
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
URL https://gitee.com/openeuler/libboundscheck/repository/archive/v1.1.10.tar.gz
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
SOURCE_DIR ${GE_CODE_DIR}/../libc_sec
CONFIGURE_COMMAND ${CMAKE_COMMAND}

@ -1,5 +1,5 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
* Copyright 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.

@ -0,0 +1,111 @@
/**
* Copyright 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 INC_FRAMEWORK_OMG_PARSER_MODEL_PARSER_H_
#define INC_FRAMEWORK_OMG_PARSER_MODEL_PARSER_H_
#include <google/protobuf/message.h>
#include "framework/omg/parser/parser_types.h"
#include "framework/omg/omg_inner_types.h"
#include "graph/attr_value.h"
#include "graph/compute_graph.h"
#include "graph/ge_tensor.h"
#include "graph/graph.h"
#include "graph/op_desc.h"
#include "graph/operator.h"
#include "graph/range_vistor.h"
#include "graph/utils/attr_utils.h"
#include "graph/utils/graph_utils.h"
#include "graph/utils/op_desc_utils.h"
#include "graph/utils/tensor_utils.h"
using Status = domi::Status;
namespace domi {
using GetGraphCallback = std::function<std::unique_ptr<google::protobuf::Message>(
const google::protobuf::Message *root_proto, const std::string &graph)>;
class ModelParser {
public:
ModelParser() {}
virtual ~ModelParser() {}
/**
* @ingroup domi_omg
* @brief Analyze network model data
* @param [in] file Network model file path
* @param [in|out] graph Save the network information after analysis
* @return SUCCESS
* @return Others failed
*/
virtual Status Parse(const char *file, ge::Graph &graph) = 0;
/**
* @ingroup domi_omg
* @brief Parse relevant data from memory and save it to graph
* @param [in] input Model file memory data
* @param [in|out] graph A graph for saving the model information after analysis
* @return SUCCESS
* @return FAILED
* @author
*/
virtual Status ParseFromMemory(const char *data, uint32_t size, ge::ComputeGraphPtr &graph) = 0;
/**
* @ingroup domi_omg
* @brief Analyze network model data
* @param [in] proto network model
* @param [in|out] graph Save the network information after analysis
* @return SUCCESS
* @return Others failed
*/
virtual Status ParseProto(const google::protobuf::Message *proto, ge::ComputeGraphPtr &graph) = 0;
/**
* @ingroup domi_omg
* @brief Analyze callback model data in subgraph
* @param [in] proto network model
* @param [in] callback callback of subgraph
* @param [in|out] graph Save the network information after analysis
* @return SUCCESS
* @return Others failed
*/
virtual Status ParseProtoWithSubgraph(const google::protobuf::Message *proto,
GetGraphCallback callback,
ge::ComputeGraphPtr &graph) = 0;
/**
* @ingroup domi_omg
* @brief Convert model files to JSON format
* @param [in] model_file Model file path to be converted
* @param [out] json_file Converted JSON file path
* @return SUCCESS
* @return Others failed
*/
virtual Status ToJson(const char *model_file, const char *json_file) { return domi::SUCCESS; }
/*
* @ingroup domi_omg
* @brief Convert network data type
* @param [in] type Data type to be converted
* @return ge::DataType
*/
virtual ge::DataType ConvertToGeDataType(const uint32_t type) = 0;
virtual Status ParseAllGraph(const google::protobuf::Message *root_proto, ge::ComputeGraphPtr &root_graph) = 0;
};
} // namespace domi
#endif // INC_FRAMEWORK_OMG_PARSER_MODEL_PARSER_H_

@ -0,0 +1,92 @@
/**
* Copyright 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 INC_FRAMEWORK_OMG_PARSER_OP_PARSER_H_
#define INC_FRAMEWORK_OMG_PARSER_OP_PARSER_H_
#include <google/protobuf/text_format.h>
#include "framework/omg/parser/parser_types.h"
#include "omg/omg_inner_types.h"
#include "proto/om.pb.h"
#include "graph/ge_tensor.h"
#include "graph/op_desc.h"
#include "graph/utils/op_desc_utils.h"
using google::protobuf::Message;
using Status = domi::Status;
namespace ge {
/**
* @ingroup domi_omg
* @brief Used to analyze operator information
*
*/
class OpParser {
public:
/**
* @ingroup domi_omg
* @brief Deconstructor
*/
virtual ~OpParser() {}
/**
* @ingroup domi_omg
* @brief Analytic operator parameters
* @param [in] op_src Parameter data to be resolved
* @param [out] graph Parsed parameter data
* @return SUCCESS
* @return FAILED
*/
virtual Status ParseParams(const Message *op_src, ge::OpDescPtr &op_desc) = 0;
/**
* @ingroup domi_omg
* @brief Analytic operator parameters
* @param [in] op_src Parameter data to be resolved
* @param [out] Operator parameter data
* @return SUCCESS
* @return FAILED
*/
virtual Status ParseParams(const Message *op_src, ge::Operator &op_dest) = 0;
/**
* @ingroup domi_omg
* @brief Analytic operator weight information
* @param [in] op_src Weight data to be resolved
* @param [out] op_dest Weight data after analysis
* @return SUCCESS
* @return FAILED
*/
virtual Status ParseWeights(const Message *op_src, ge::NodePtr &node) = 0;
/**
* @ingroup domi_omg
* @brief Get the format information according to the parameters in the operator
* @param [in] op_src Parameter data to be resolved
* @param [out] format Output the parsed format
* @return SUCCESS
* @return FAILED
*/
virtual Status GetFormat(const Message *op_src, domi::domiTensorFormat_t &format) {
(void)op_src;
// Indicates that the op does not provide a value for format
format = domi::DOMI_TENSOR_RESERVED;
return domi::SUCCESS;
}
};
} // namespace ge
#endif // INC_FRAMEWORK_OMG_PARSER_OP_PARSER_H_

@ -0,0 +1,31 @@
/**
* Copyright 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 INC_FRAMEWORK_OMG_PARSER_PARSER_API_H_
#define INC_FRAMEWORK_OMG_PARSER_PARSER_API_H_
#include <iostream>
#include <map>
#include <string>
#include "ge/ge_api_error_codes.h"
namespace ge {
// Initialize parser
Status ParserInitialize(const std::map<std::string, std::string>& options);
// Finalize parser, release all resources
Status ParserFinalize();
} // namespace ge
#endif // INC_FRAMEWORK_OMG_PARSER_PARSER_API_H_

@ -0,0 +1,138 @@
/**
* Copyright 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 INC_FRAMEWORK_OMG_PARSER_PARSER_FACTORY_H_
#define INC_FRAMEWORK_OMG_PARSER_PARSER_FACTORY_H_
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include "framework/omg/omg_inner_types.h"
#include "framework/omg/parser/parser_types.h"
using Status = domi::Status;
namespace domi {
class WeightsParser;
class ModelParser;
typedef std::shared_ptr<ModelParser> (*MODEL_PARSER_CREATOR_FUN)(void);
// Create modelparser for different frameworks
class ModelParserFactory {
public:
static ModelParserFactory *Instance();
/**
* @ingroup domi_omg
* @brief Create a modelparser based on the type entered
* @param [in] type Framework type
* @return Created modelparser
*/
std::shared_ptr<ModelParser> CreateModelParser(const domi::FrameworkType type);
/**
* @ingroup domi_omg
* @brief Register create function
* @param [in] type Framework type
* @param [in] fun ModelParser's create function
*/
void RegisterCreator(const domi::FrameworkType type, MODEL_PARSER_CREATOR_FUN fun);
protected:
ModelParserFactory() {}
~ModelParserFactory();
private:
std::map<domi::FrameworkType, MODEL_PARSER_CREATOR_FUN> creator_map_;
}; // end class ModelParserFactory
class ModelParserRegisterar {
public:
ModelParserRegisterar(const domi::FrameworkType type, MODEL_PARSER_CREATOR_FUN fun) {
ModelParserFactory::Instance()->RegisterCreator(type, fun);
}
~ModelParserRegisterar() {}
};
// Registration macros for model parsers
#define REGISTER_MODEL_PARSER_CREATOR(type, clazz) \
std::shared_ptr<ModelParser> Creator_##type##_Model_Parser() { \
std::shared_ptr<clazz> ptr = nullptr; \
try { \
ptr = make_shared<clazz>(); \
} catch (...) { \
ptr = nullptr; \
} \
return std::shared_ptr<ModelParser>(ptr); \
} \
ModelParserRegisterar g_##type##_Model_Parser_Creator(type, Creator_##type##_Model_Parser)
typedef std::shared_ptr<WeightsParser> (*WEIGHTS_PARSER_CREATOR_FUN)(void);
// Create weightsparser for different frameworks
class WeightsParserFactory {
public:
static WeightsParserFactory *Instance();
/**
* @ingroup domi_omg
* @brief Create weightsparser based on the type entered
* @param [in] type Framework type
* @return Created weightsparser
*/
std::shared_ptr<WeightsParser> CreateWeightsParser(const domi::FrameworkType type);
/**
* @ingroup domi_omg
* @brief Register create function
* @param [in] type Framework type
* @param [in] fun WeightsParser's create function
*/
void RegisterCreator(const domi::FrameworkType type, WEIGHTS_PARSER_CREATOR_FUN fun);
protected:
WeightsParserFactory() {}
~WeightsParserFactory();
private:
std::map<domi::FrameworkType, WEIGHTS_PARSER_CREATOR_FUN> creator_map_;
}; // end class WeightsParserFactory
class WeightsParserRegisterar {
public:
WeightsParserRegisterar(const domi::FrameworkType type, WEIGHTS_PARSER_CREATOR_FUN fun) {
WeightsParserFactory::Instance()->RegisterCreator(type, fun);
}
~WeightsParserRegisterar() {}
};
// Register macro of weight resolver
#define REGISTER_WEIGHTS_PARSER_CREATOR(type, clazz) \
std::shared_ptr<WeightsParser> Creator_##type##_Weights_Parser() { \
std::shared_ptr<clazz> ptr = nullptr; \
try { \
ptr = make_shared<clazz>(); \
} catch (...) { \
ptr = nullptr; \
} \
return std::shared_ptr<WeightsParser>(ptr); \
} \
WeightsParserRegisterar g_##type##_Weights_Parser_Creator(type, Creator_##type##_Weights_Parser)
}; // namespace domi
#endif // INC_FRAMEWORK_OMG_PARSER_PARSER_FACTORY_H_

@ -0,0 +1,68 @@
/**
* 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 INC_FRAMEWORK_OMG_PARSER_PARSER_INNER_CONTEXT_H_
#define INC_FRAMEWORK_OMG_PARSER_PARSER_INNER_CONTEXT_H_
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "external/register/register_fmk_types.h"
#include "external/register/register_types.h"
#include "framework/omg/omg_inner_types.h"
namespace ge {
struct ParserContext {
// format of the input specified by the command line
std::unordered_map<std::string, domiTensorFormat_t> input_nodes_format_map;
// user-designate input dims
std::vector<std::pair<std::string, std::vector<int64_t>>> user_input_dims;
std::unordered_map<std::string, std::vector<int64_t>> input_dims;
// resolve the mapping between operators with the same name and corresponding network. format e.g.
// Detectionoutput:SsdDetectiontOutput
std::map<std::string, std::string> op_conf_map;
// user-designate out nodes (this is used for determing the orders)
std::vector<std::pair<std::string, int32_t>> user_out_nodes;
// default out nodes (this is used for determing the orders)
std::vector<std::pair<std::string, int32_t>> default_out_nodes;
// save the output node of the network. key = operator name, value = index, index indicates the output index of the
// operator
std::map<std::string, std::vector<int32_t>> out_nodes_map;
// save the output node of the network, value = topName,
// topName indicates the output name of the operator.
std::vector<std::string> user_out_nodes_top_vec;
// net out nodes (where user_out_nodes or leaf nodes)
std::vector<std::string> net_out_nodes;
// net out nodes top names(only caffe has top)
std::vector<std::string> out_top_names;
// Whether to use dynamic batch size or dynamic image size
bool is_dynamic_input = false;
bool train_flag = false;
domi::domiTensorFormat_t format = domi::DOMI_TENSOR_ND;
domi::FrameworkType type = domi::FRAMEWORK_RESERVED;
RunMode run_mode = ONLY_PRE_CHECK;
std::string custom_proto_path; // save caffe custom proto path, used by caffe parse
std::string caffe_proto_path; // save caffe proto path, used by caffe parse
std::string enable_scope_fusion_passes; // name of the pass that needs to take effect
};
ParserContext &GetParserContext();
} // namespace ge
#endif // INC_FRAMEWORK_OMG_PARSER_PARSER_INNER_CONTEXT_H_

File diff suppressed because it is too large Load Diff

@ -0,0 +1,74 @@
/**
* Copyright 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 INC_FRAMEWORK_OMG_PARSER_WEIGHTS_PARSER_H_
#define INC_FRAMEWORK_OMG_PARSER_WEIGHTS_PARSER_H_
#include "graph/graph.h"
#include "graph/attr_value.h"
#include "graph/compute_graph.h"
#include "graph/ge_tensor.h"
#include "graph/op_desc.h"
#include "graph/operator.h"
#include "graph/range_vistor.h"
#include "graph/utils/attr_utils.h"
#include "graph/utils/op_desc_utils.h"
#include "graph/utils/tensor_utils.h"
namespace domi {
/**
* @ingroup domi_omg
* @brief Weight information resolver
*
*/
class WeightsParser {
public:
/**
* @ingroup domi_omg
* @brief Constructor
*/
WeightsParser() {}
/**
* @ingroup domi_omg
* @brief Deconstructor
*/
virtual ~WeightsParser() {}
/**
* @ingroup domi_omg
* @brief Analyze weight data
* @param [in] file Path of weight file after training
* @param [in|out] graph Graph for saving weight information after analysis
* @return SUCCESS
* @return Others failed
*/
virtual Status Parse(const char *file, ge::Graph &graph) = 0;
/**
* @ingroup domi_omg
* @brief Parse relevant data from memory and save it to graph
* @param [in] input Model file memory data
* @param [in|out] graph A graph for saving the model information after analysis
* @return SUCCESS
* @return FAILED
* @author
*/
virtual Status ParseFromMemory(const char *input, uint32_t lengt, ge::ComputeGraphPtr &graph) = 0;
};
} // namespace domi
#endif // INC_FRAMEWORK_OMG_PARSER_WEIGHTS_PARSER_H_
Loading…
Cancel
Save