From 3ddbb6f6f8ecb625bf81b750a788e7d75309334c Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期三, 25 十二月 2024 11:48:49 +0800 Subject: [PATCH] 模型输入时间计算调整 --- iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm index eeb2f81..ddf78cf 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm @@ -17,7 +17,15 @@ { PyGILThreadLock lock; - PyObject* pModule = create_py_module("${pyModule}.${pyName}"); + + jclass hashmapClass = env->FindClass("java/util/HashMap"); + jmethodID getMID = env->GetMethodID(hashmapClass, "get", "(Ljava/lang/Object;)Ljava/lang/Object;"); + jstring keyJString = env->NewStringUTF("pyFile"); + jobject javaValueObj = env->CallObjectMethod(settings, getMID, keyJString); + const char* strValue = env->GetStringUTFChars((jstring)javaValueObj, NULL); + + PyObject* pModule = create_py_module(strValue); + /*PyObject* pModule = create_py_module("${pyModule}.${pyName}");*/ if (pModule == NULL) { cout << "model error" << endl; @@ -80,7 +88,7 @@ cout << "ConvertPydictToJhmap error" << endl; throw "函数返回值异常!"; } - delete pModule; + /*delete pModule; pModule = nullptr; delete pModule; @@ -108,6 +116,11 @@ pArg = nullptr; delete pArg; + Py_DECREF(pReturn); + Py_DECREF(pFunc); + Py_DECREF(pModule); + Py_CLEAR(pModule);*/ + return result; } catch (const char* msg) -- Gitblit v1.9.3