潘志宝
2024-09-12 27e7299964b861c079dbb2826edab00dfd6dc27d
提交 | 用户 | 时间
449017 1 \#include "pch.h"
D 2 \#include"cstring"
3 \#include <iostream>  
4 \#include "framework.h"
5 \#include <fstream>
6 \#include <stdio.h>
7 \#include <stdlib.h>
8 \#include <string.h>
9 \#include"${pyName}Jni.h"
10
11 JNIEXPORT jobject JNICALL Java_${pkgName.replace('.','_')}_impl_${pyName}Impl_${pyName}Train(JNIEnv* env, jobject object1, jobjectArray data_train, jobject settings)
12 {
13     jclass class_hashmap = env->FindClass("java/util/HashMap");
14     jmethodID hashmap_construct_method = env->GetMethodID(class_hashmap, "<init>", "()V");
15     jobject obj_hashmap = env->NewObject(class_hashmap, hashmap_construct_method, "");
16     env->DeleteLocalRef(class_hashmap);
17
18     obj_hashmap = ${pyName}_train(env, data_train, settings);
19     return  obj_hashmap;
20 }
21
22 JNIEXPORT jobject JNICALL Java_${pkgName.replace('.','_')}_impl_${pyName}Impl_${pyName}Predict(JNIEnv* env, jobject object1, #{foreach} ($column in [1..$dataLength])jobjectArray data${column}, #{end}jobject model_path_, jobject settings)
23 {
24     jclass class_hashmap = env->FindClass("java/util/HashMap");
25     jmethodID hashmap_construct_method = env->GetMethodID(class_hashmap, "<init>", "()V");
26     jobject obj_hashmap = env->NewObject(class_hashmap, hashmap_construct_method, "");
27     env->DeleteLocalRef(class_hashmap);
28
29     obj_hashmap = ${pyName}_predict(env, #{foreach} ($column in [1..$dataLength])data${column}, #{end}model_path_, settings);
30     return  obj_hashmap;
31 }