/** * 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_EXTERNAL_GE_IR_BUILD_H_ #define INC_EXTERNAL_GE_IR_BUILD_H_ #include #include #include #include "graph/graph.h" #include "graph/ge_error_codes.h" namespace { const int IR_MAJOR_VERSION = 1; const int IR_MINOR_VERSION = 0; const int IR_PATCH_VERSION = 0; } // namespace namespace ge { struct ModelBufferData { std::shared_ptr data = nullptr; uint64_t length; }; /** * @ingroup AscendCL * @brief build model.Notice the model is stored in buffer * * @param global_options[IN] global init params for build * @retval GRAPH_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ ATTRIBUTED_DEPRECATED(graphStatus aclgrphBuildInitialize(std::map &)) graphStatus aclgrphBuildInitialize(std::map global_options); graphStatus aclgrphBuildInitialize(std::map &global_options); /** * @ingroup AscendCL * @brief build model.Notice the model is stored in buffer * */ void aclgrphBuildFinalize(); /** * @ingroup AscendCL * @brief build model.Notice the model is stored in buffer * * @param graph[IN] the graph ready to build * @param options[IN] options used for build * @param model[OUT] builded model * @retval GRAPH_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ ATTRIBUTED_DEPRECATED(graphStatus aclgrphBuildModel(const ge::Graph &, const std::map &, ModelBufferData &)) graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, ModelBufferData &model); graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, ModelBufferData &model); /** * @ingroup AscendCL * @brief save model buffer to file * * @param output_file[IN] the file path to be saved * @param model[IN] model buffer data * @retval GRAPH_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ ATTRIBUTED_DEPRECATED(graphStatus aclgrphSaveModel(const char *, const ModelBufferData &)) graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &model); graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &model); /** * @ingroup AscendCL * @brief query IR interface version * * @param major_version[OUT] IR interface major version * @param minor_version[OUT] IR interface minor version * @param patch_version[OUT] IR interface patch version * @retval GRAPH_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ graphStatus aclgrphGetIRVersion(int *major_version, int *minor_version, int *patch_version); /** * @ingroup AscendCL * @brief dump graph * * @param graph[IN] the graph ready to build * @param file[IN] file path * @param file[IN] file path string len * @retval GRAPH_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const size_t len); /** * @ingroup AscendCL * @brief create single op graph * * @param op_type[IN] the op_type * @param inputs[IN] the inputdesc * @param outputs[IN] the outputdesc * @param graph[OUT] the graph * @retval GRAPH_SUCCESS The function is successfully executed. * @retval OtherValues Failure */ graphStatus aclgrphGenerateForOp(const AscendString &op_type, const std::vector &inputs, const std::vector &outputs, Graph &graph); }; // namespace ge #endif // INC_EXTERNAL_GE_IR_BUILD_H_