| @@ -660,33 +660,6 @@ Status Session::RegisterCallBackFunc(const char *key, const session::pCallBackFu | |||||
| return ge::GELib::GetInstance()->SessionManagerObj().RegisterCallBackFunc(sessionId_, str_key, callback); | return ge::GELib::GetInstance()->SessionManagerObj().RegisterCallBackFunc(sessionId_, str_key, callback); | ||||
| } | } | ||||
| // Build Graph | |||||
| Status Session::BuildGraph(uint32_t graph_id, const std::vector<InputTensorInfo> &inputs) { | |||||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||||
| std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | |||||
| if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | |||||
| GELOGE(GE_CLI_GE_NOT_INITIALIZED, | |||||
| "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag, " | |||||
| "session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
| REPORT_INNER_ERROR("E19999", | |||||
| "Build graph failed, the GELib instance is nullptr or is not InitFlag, " | |||||
| "session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
| return FAILED; | |||||
| } | |||||
| GELOGT(TRACE_RUNNING, "Building Graph"); | |||||
| Status ret = instance_ptr->SessionManagerObj().BuildGraph(sessionId_, graph_id, inputs); | |||||
| if (ret != SUCCESS) { | |||||
| GELOGE(ret, | |||||
| "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", | |||||
| ret, sessionId_, graph_id); | |||||
| REPORT_CALL_ERROR("E19999", "Build graph failed , error code:%u, " | |||||
| "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); | |||||
| return FAILED; | |||||
| } | |||||
| return SUCCESS; | |||||
| } | |||||
| // Build Graph | // Build Graph | ||||
| Status Session::BuildGraph(uint32_t graph_id, const std::vector<ge::Tensor> &inputs) { | Status Session::BuildGraph(uint32_t graph_id, const std::vector<ge::Tensor> &inputs) { | ||||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | ||||
| @@ -394,32 +394,6 @@ Status InnerSession::RegisterCallBackFunc( | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| Status InnerSession::BuildGraph(uint32_t graph_id, const std::vector<InputTensorInfo> &inputs) { | |||||
| UpdateThreadContext(graph_id); | |||||
| GELOGI("[InnerSession:%lu] build graph on session, graph_id=%u.", session_id_, graph_id); | |||||
| std::vector<ge::GeTensor> ge_inputs; | |||||
| for (auto const &input : inputs) { | |||||
| std::vector<int64_t> input_dims; | |||||
| std::transform(input.dims.begin(), input.dims.end(), std::back_inserter(input_dims), | |||||
| [](int64_t x) -> int64_t { return x; }); | |||||
| GeShape input_shape(input_dims); | |||||
| GeTensorDesc input_tensor_desc; | |||||
| input_tensor_desc.SetShape(input_shape); | |||||
| input_tensor_desc.SetDataType(static_cast<ge::DataType>(input.data_type)); | |||||
| ge_inputs.emplace_back(input_tensor_desc); | |||||
| } | |||||
| GeRootModelPtr ge_root_model = nullptr; | |||||
| Status ret = graph_manager_.BuildGraph(graph_id, ge_inputs, ge_root_model, session_id_, true); | |||||
| if (ret != SUCCESS) { | |||||
| GELOGE(ret, "[Build][Graph] failed, InnerSession:%lu graph_id=%u.", session_id_, graph_id); | |||||
| REPORT_CALL_ERROR("E19999", | |||||
| "GraphManager BuildGraph failed, InnerSession:%lu graph_id=%u.", session_id_, graph_id); | |||||
| return ret; | |||||
| } | |||||
| GELOGI("[InnerSession:%lu] build graph success, graph_id=%u.", session_id_, graph_id); | |||||
| return ret; | |||||
| } | |||||
| Status InnerSession::BuildGraph(uint32_t graph_id, const std::vector<ge::Tensor> &inputs) { | Status InnerSession::BuildGraph(uint32_t graph_id, const std::vector<ge::Tensor> &inputs) { | ||||
| UpdateThreadContext(graph_id); | UpdateThreadContext(graph_id); | ||||
| GELOGI("[InnerSession:%lu] build graph on session, graph_id=%u.", session_id_, graph_id); | GELOGI("[InnerSession:%lu] build graph on session, graph_id=%u.", session_id_, graph_id); | ||||
| @@ -46,8 +46,6 @@ class InnerSession { | |||||
| Status RemoveGraph(uint32_t graph_id); | Status RemoveGraph(uint32_t graph_id); | ||||
| Status BuildGraph(uint32_t graph_id, const std::vector<InputTensorInfo> &inputs); | |||||
| Status BuildGraph(uint32_t graph_id, const std::vector<ge::Tensor> &inputs); | Status BuildGraph(uint32_t graph_id, const std::vector<ge::Tensor> &inputs); | ||||
| Status RunGraphAsync(uint32_t graph_id, const std::vector<ge::Tensor> &inputs, RunAsyncCallback callback); | Status RunGraphAsync(uint32_t graph_id, const std::vector<ge::Tensor> &inputs, RunAsyncCallback callback); | ||||
| @@ -363,27 +363,6 @@ Status SessionManager::RegisterCallBackFunc( | |||||
| return innerSession->RegisterCallBackFunc(key, callback); | return innerSession->RegisterCallBackFunc(key, callback); | ||||
| } | } | ||||
| Status SessionManager::BuildGraph(SessionId session_id, uint32_t graph_id, const std::vector<InputTensorInfo> &inputs) { | |||||
| if (!init_flag_) { | |||||
| GELOGE(GE_SESSION_MANAGER_NOT_INIT, "[Build][Graph]fail for Session manager is not initialized," | |||||
| "session_id:%lu, graph_id:%u.", session_id, graph_id); | |||||
| REPORT_INNER_ERROR("E19999", "BuildGraph fail for Session manager is not initialized," | |||||
| "session_id:%lu, graph_id:%u.", session_id, graph_id); | |||||
| return GE_SESSION_MANAGER_NOT_INIT; | |||||
| } | |||||
| SessionPtr innerSession = nullptr; | |||||
| { | |||||
| std::lock_guard<std::mutex> lock(mutex_); | |||||
| std::map<SessionId, SessionPtr>::iterator it = session_manager_map_.find(session_id); | |||||
| if (it == session_manager_map_.end()) { | |||||
| return GE_SESSION_NOT_EXIST; | |||||
| } else { | |||||
| innerSession = it->second; | |||||
| } | |||||
| } | |||||
| return innerSession->BuildGraph(graph_id, inputs); | |||||
| } | |||||
| Status SessionManager::BuildGraph(SessionId session_id, uint32_t graph_id, const std::vector<ge::Tensor> &inputs) { | Status SessionManager::BuildGraph(SessionId session_id, uint32_t graph_id, const std::vector<ge::Tensor> &inputs) { | ||||
| if (!init_flag_) { | if (!init_flag_) { | ||||
| GELOGE(GE_SESSION_MANAGER_NOT_INIT, "[Build][Graph]fail for Session manager is not initialized," | GELOGE(GE_SESSION_MANAGER_NOT_INIT, "[Build][Graph]fail for Session manager is not initialized," | ||||
| @@ -137,8 +137,6 @@ class SessionManager { | |||||
| /// @param [in] inputs input data | /// @param [in] inputs input data | ||||
| /// @return Status result of function | /// @return Status result of function | ||||
| /// | /// | ||||
| Status BuildGraph(SessionId session_id, uint32_t graph_id, const std::vector<InputTensorInfo> &inputs); | |||||
| Status BuildGraph(SessionId session_id, uint32_t graph_id, const std::vector<ge::Tensor> &inputs); | Status BuildGraph(SessionId session_id, uint32_t graph_id, const std::vector<ge::Tensor> &inputs); | ||||
| /// | /// | ||||
| @@ -140,9 +140,7 @@ class GE_FUNC_VISIBILITY Session { | |||||
| /// @param [in] inputs: input data | /// @param [in] inputs: input data | ||||
| /// @return Status result of function | /// @return Status result of function | ||||
| /// | /// | ||||
| Status BuildGraph(uint32_t graphId, const std::vector<InputTensorInfo> &inputs); | |||||
| Status BuildGraph(uint32_t graphId, const std::vector<ge::Tensor> &inputs); /*lint !e148*/ | |||||
| Status BuildGraph(uint32_t graphId, const std::vector<ge::Tensor> &inputs); | |||||
| /// | /// | ||||
| /// @ingroup ge_graph | /// @ingroup ge_graph | ||||