diff --git a/tf_adapter/kernels/aicpu/dataset_function.cc b/tf_adapter/kernels/aicpu/dataset_function.cc index e0bf7903bf6c04466ea6fe886f304add78148185..eded0909644da6366510930781b595e46d9d6e05 100644 --- a/tf_adapter/kernels/aicpu/dataset_function.cc +++ b/tf_adapter/kernels/aicpu/dataset_function.cc @@ -48,6 +48,7 @@ #include "tf_adapter/util/infershape_util.h" #include "tf_adapter/util/ge_plugin.h" #include "graph/utils/graph_utils.h" +#include "graph/utils/graph_utils_ex.h" #include "graph/compute_graph.h" #include "graph/op_desc.h" #include "runtime/dev.h" @@ -545,7 +546,7 @@ Status DatasetFunction::CreateGeGraph(const std::shared_ptr & DumpGeComputeGraph(std::string("Build"), funcName_, compute_graph); - ge_graph_ = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); + ge_graph_ = ge::GraphUtilsEx::CreateGraphFromComputeGraph(compute_graph); return Status::OK(); } diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc index b87902a0b704774560c206365f9101dc512a3396..8b40f8c0941ec466ec82a6a6cfe623b86a64a6c1 100644 --- a/tf_adapter/kernels/geop_npu.cc +++ b/tf_adapter/kernels/geop_npu.cc @@ -69,6 +69,7 @@ #include "graph/ascend_string.h" #include "graph/utils/graph_utils.h" +#include "graph/utils/graph_utils_ex.h" #include "graph/utils/node_adapter.h" #include "graph/compute_graph.h" #include "graph/ge_attr_value.h" @@ -847,7 +848,7 @@ void GeOp::ComputeAsync(OpKernelContext *ctx, DoneCallback done) { if (graph_options_.count("input_format") != 0) { ADP_LOG(INFO) << "graph_options_[\"input_format\"] = " << graph_options_["input_format"]; } - ge::Graph ge_graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); + ge::Graph ge_graph = ge::GraphUtilsEx::CreateGraphFromComputeGraph(compute_graph); if (iteration_per_loop_ > 1) { ge_graph.SetNeedIteration(this->need_iteration_); } @@ -1334,7 +1335,7 @@ Status GeOp::ParseOnnxGraphOpAttr(Node *&node) const { } ge::Model onnx_model("onnx_compute_model_" + node->name(), ""); - onnx_model.SetGraph(sub_graph); + onnx_model.SetGraph(ge::GraphUtilsEx::GetComputeGraph(sub_graph)); ge::Buffer model_buf; NPU_REQUIRES(onnx_model.Save(model_buf, false) == ge::SUCCESS, errors::Internal("[GEOP] node:", node->name(), " Onnx Model Serialized Failed.")); @@ -1547,7 +1548,7 @@ int GeOp::RunTuning(std::vector &input_vec, std::vector &inp ADP_LOG(INFO) << "[GEOP] Tensorflow graph parse to ge graph success."; // convert to ge::graph - ge::Graph ge_graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); + ge::Graph ge_graph = ge::GraphUtilsEx::CreateGraphFromComputeGraph(compute_graph); if (iteration_per_loop_ > 1) { ge_graph.SetNeedIteration(this->need_iteration_); } diff --git a/tf_adapter/tests/depends/ge_runner/src/ge_runner_stub.cc b/tf_adapter/tests/depends/ge_runner/src/ge_runner_stub.cc index f18814e8528fe267b7c114a77958b3c69d25cc44..7b9863acd63fdbd85c01023e2bd91f947c401562 100644 --- a/tf_adapter/tests/depends/ge_runner/src/ge_runner_stub.cc +++ b/tf_adapter/tests/depends/ge_runner/src/ge_runner_stub.cc @@ -360,7 +360,7 @@ size_t ComputeGraph::GetAllNodesSize() const { Graph::Graph(const std::string& grph) {} Graph::Graph(char const* name) {} -Graph GraphUtils::CreateGraphFromComputeGraph(const ComputeGraphPtr compute_graph) { return Graph("ge"); } +Graph GraphUtilsEx::CreateGraphFromComputeGraph(const ComputeGraphPtr compute_graph) { return Graph("ge"); } void GraphUtils::DumpGEGraph(const ComputeGraphPtr &graph, const std::string &suffix, diff --git a/tf_adapter_2.x/npu_device/core/npu_device.cpp b/tf_adapter_2.x/npu_device/core/npu_device.cpp index cc0173763c7c44902293d8d5cff37b5831269c69..6aee8c77b86f5635021d29f4809182817ed881ca 100644 --- a/tf_adapter_2.x/npu_device/core/npu_device.cpp +++ b/tf_adapter_2.x/npu_device/core/npu_device.cpp @@ -30,6 +30,7 @@ #include "npu_managed_buffer.h" #include "npu_tensor.h" #include "npu_utils.h" +#include "graph/utils/graph_utils_ex.h" #include "optimizers/npu_optimizer_manager.h" @@ -983,7 +984,7 @@ tensorflow::Status NpuDevice::TransTfGraph2GeGraph(TFE_Context *context, const s tensorflow::errors::Internal("NPU Parse tensorflow model failed")); if (ge_compute_graph->GetAllNodesSize() != 0) { - ge_graph = ge::GraphUtils::CreateGraphFromComputeGraph(ge_compute_graph); + ge_graph = ge::GraphUtilsEx::CreateGraphFromComputeGraph(ge_compute_graph); } return tensorflow::Status::OK(); diff --git a/tf_adapter_2.x/tests/stub/ge_stub.cpp b/tf_adapter_2.x/tests/stub/ge_stub.cpp index 32716883c8fc9fe4e0171e3a6278c3698bd7358a..48a717cdc478e915be8bab77447f18e06f919a22 100644 --- a/tf_adapter_2.x/tests/stub/ge_stub.cpp +++ b/tf_adapter_2.x/tests/stub/ge_stub.cpp @@ -16,7 +16,7 @@ limitations under the License. #include "ge/ge_api.h" namespace ge { -Graph GraphUtils::CreateGraphFromComputeGraph(const ge::ComputeGraphPtr compute_graph) { +Graph GraphUtilsEx::CreateGraphFromComputeGraph(const ge::ComputeGraphPtr compute_graph) { Graph graph; graph.graph = compute_graph->graph; return graph;