-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++] #3 Included bridge project into cpp server
- Loading branch information
1 parent
bc18c63
commit 95a9478
Showing
13 changed files
with
2,277 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include_directories(includes) | ||
|
||
add_library(bridge SHARED ./src/bridge.cpp ./src/model/${MODEL_TYPE}.cpp) | ||
target_link_libraries(bridge "${TORCH_LIBRARIES}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef __BRIDGE_HPP__ | ||
#define __BRIDGE_HPP__ | ||
|
||
#include "jni.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* JNI */ | ||
|
||
JNIEXPORT jlong JNICALL Java_EvalJNI_loadModel | ||
(JNIEnv *, jobject, jstring); | ||
|
||
JNIEXPORT jfloatArray JNICALL Java_EvalJNI_evaluate | ||
(JNIEnv *, jobject, jlong, jfloatArray); | ||
|
||
/* C Interface */ | ||
|
||
typedef void* Eval; | ||
|
||
Eval EvalInit(); | ||
void EvalFree(Eval); | ||
long EvalLoadModel(Eval eval, const char* modelName); | ||
float* EvalEvaluate(Eval eval, long pModel, float* x); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.