Beatmup
wrapper_nnets.cpp File Reference
#include "wrapper.h"
#include "include/Beatmup_NNets_AbstractOperation.h"
#include "include/Beatmup_NNets_DeserializedModel.h"
#include "include/Beatmup_NNets_InferenceTask.h"
#include "include/Beatmup_NNets_ImageSampler.h"
#include "include/Beatmup_NNets_Model.h"
#include "include/Beatmup_NNets_Softmax.h"
#include "android/context.h"
#include <core/nnets/deserialized_model.h>
#include <core/nnets/inference_task.h>
#include <iostream>
#include <sstream>

Go to the source code of this file.

Functions

 BEATMUP_OBJ (Beatmup::NNets::Model, model, handle)
 
return jenv NewStringUTF (model->serializeToString().c_str())
 
 return (jlong) model -> countMultiplyAdds()
 
 BEATMUP_OBJ (Beatmup::Android::Context, ctx, jCtx)
 
 BEATMUP_STRING (str)
 
 BEATMUP_CATCH ({ auto model=new Beatmup::NNets::DeserializedModel(*ctx, strStr); $pool.addJavaReference(jenv, jCtx, model);return(jlong) model;})
 
 BEATMUP_OBJ (Beatmup::NNets::AbstractOperation, op, handle)
 
return jenv NewStringUTF (op->getName().c_str())
 
 BEATMUP_STRING (name)
 
 catch (Beatmup::InvalidArgument &ex)
 
 BEATMUP_OBJ (Beatmup::NNets::Softmax, softmax, handle)
 
 for (size_t i=0;i< proba.size();++i) outptr[i]
 
jenv ReleaseFloatArrayElements (result, outptr, 0)
 
 BEATMUP_OBJ (Beatmup::NNets::ImageSampler, imageSampler, handle)
 
imageSampler setRotation ((int) rotation)
 
 return (jint) imageSampler -> getRotation()
 
 BEATMUP_OBJ (Beatmup::NNets::Model, model, jModel)
 
 BEATMUP_OBJ (Beatmup::ChunkCollection, data, jData)
 
$pool addJavaReference (jenv, jModel, task)
 
$pool addJavaReference (jenv, jData, task)
 
 BEATMUP_OBJ (Beatmup::NNets::InferenceTask, task, handle)
 
 BEATMUP_OBJ (Beatmup::AbstractBitmap, bitmap, jBitmap)
 
 BEATMUP_STRING (opName)
 
 BEATMUP_OBJ (Beatmup::NNets::AbstractOperation, op, hOp)
 
task connect * bitmap (int) index
 

Variables

JNIEnv * jenv
 
JNIEnv jobject
 
JNIEnv jlong handle
 
JNIEnv jclass
 
JNIEnv jobject jCtx
 
JNIEnv jobject jstring str
 
JNIEnv jlong jstring name
 
 try
 
const auto & proba = softmax->getProbabilities()
 
jfloatArray result = jenv->NewFloatArray(proba.size())
 
jfloat * outptr = jenv->GetFloatArrayElements(result, nullptr)
 
JNIEnv jlong jint rotation
 
JNIEnv jobject jModel
 
JNIEnv jobject jobject jData
 
Beatmup::NNets::InferenceTasktask = new Beatmup::NNets::InferenceTask(*model, *data)
 
JNIEnv jlong jobject jBitmap
 
JNIEnv jlong jobject jstring opName
 
JNIEnv jlong jobject jstring jint index
 
JNIEnv jlong jobject jlong hOp
 

Function Documentation

◆ BEATMUP_OBJ() [1/10]

BEATMUP_OBJ ( Beatmup::NNets::Model  ,
model  ,
handle   
)

◆ NewStringUTF() [1/2]

return jenv NewStringUTF ( model->  serializeToString).c_str()

◆ return() [1/2]

return ( jlong  ) -> countMultiplyAdds()

◆ BEATMUP_OBJ() [2/10]

BEATMUP_OBJ ( Beatmup::Android::Context  ,
ctx  ,
jCtx   
)

◆ BEATMUP_STRING() [1/3]

BEATMUP_STRING ( str  )

◆ BEATMUP_CATCH()

BEATMUP_CATCH ( { auto model=new Beatmup::NNets::DeserializedModel(*ctx, strStr); $pool.addJavaReference(jenv, jCtx, model);return(jlong) model;}  )

◆ BEATMUP_OBJ() [3/10]

BEATMUP_OBJ ( Beatmup::NNets::AbstractOperation  ,
op  ,
handle   
)

◆ NewStringUTF() [2/2]

return jenv NewStringUTF ( op->  getName).c_str()

◆ BEATMUP_STRING() [2/3]

BEATMUP_STRING ( name  )

◆ catch()

catch ( Beatmup::InvalidArgument ex)

Definition at line 124 of file wrapper_nnets.cpp.

124  {
125  $pool.throwToJava(jenv, "java/lang/IllegalArgumentException", ex.what());
126  }
static void throwToJava(JNIEnv *jenv, const char *exceptionClass, const char *message)
Throws a specific exception.
Definition: objectpool.h:156
virtual const char * what() const NOEXCEPT override
Definition: exception.h:56
BeatmupJavaObjectPool $pool
JNIEnv * jenv

◆ BEATMUP_OBJ() [4/10]

BEATMUP_OBJ ( Beatmup::NNets::Softmax  ,
softmax  ,
handle   
)

◆ for()

for ( )

Definition at line 132 of file wrapper_imag.cpp.

132  {
133  Beatmup::Scene::Layer &l = scene->getLayer(i);
135  }
Abstract scene layer having name, type, geometry and some content to display.
Definition: scene.h:64
#define BEATMUP_DELETE_REFERENCE(obj)
Definition: wrapper.h:57
return $pool getJavaReference & scene(index)

◆ ReleaseFloatArrayElements()

jenv ReleaseFloatArrayElements ( result  ,
outptr  ,
 
)

◆ BEATMUP_OBJ() [5/10]

BEATMUP_OBJ ( Beatmup::NNets::ImageSampler  ,
imageSampler  ,
handle   
)

◆ setRotation()

imageSampler setRotation ( (int)  rotation)

◆ return() [2/2]

return ( jint  ) -> getRotation()

◆ BEATMUP_OBJ() [6/10]

BEATMUP_OBJ ( Beatmup::NNets::Model  ,
model  ,
jModel   
)

◆ BEATMUP_OBJ() [7/10]

BEATMUP_OBJ ( Beatmup::ChunkCollection  ,
data  ,
jData   
)

◆ addJavaReference() [1/2]

$pool addJavaReference ( jenv  ,
jModel  ,
task   
)

◆ addJavaReference() [2/2]

$pool addJavaReference ( jenv  ,
jData  ,
task   
)

◆ BEATMUP_OBJ() [8/10]

BEATMUP_OBJ ( Beatmup::NNets::InferenceTask  ,
task  ,
handle   
)

◆ BEATMUP_OBJ() [9/10]

BEATMUP_OBJ ( Beatmup::AbstractBitmap  ,
bitmap  ,
jBitmap   
)

◆ BEATMUP_STRING() [3/3]

BEATMUP_STRING ( opName  )

◆ BEATMUP_OBJ() [10/10]

BEATMUP_OBJ ( Beatmup::NNets::AbstractOperation  ,
op  ,
hOp   
)

◆ bitmap()

task connect* bitmap ( int  )

Variable Documentation

◆ jenv

JNIEnv* jenv

Definition at line 41 of file wrapper_nnets.cpp.

◆ jobject

JNIEnv jobject

Definition at line 41 of file wrapper_nnets.cpp.

◆ handle

JNIEnv jlong handle
Initial value:
{
#define BEATMUP_ENTER
Definition: wrapper.h:35

Definition at line 41 of file wrapper_nnets.cpp.

◆ jclass

JNIEnv jclass

Definition at line 80 of file wrapper_nnets.cpp.

◆ jCtx

JNIEnv jobject jCtx

Definition at line 80 of file wrapper_nnets.cpp.

◆ str

JNIEnv jobject jstring str
Initial value:

Definition at line 80 of file wrapper_nnets.cpp.

◆ name

JNIEnv jlong jstring name
Initial value:

Definition at line 116 of file wrapper_nnets.cpp.

◆ try

try
Initial value:
{
return (jlong)&model->getOperation(nameStr)
return() jlong(listener)

Definition at line 121 of file wrapper_nnets.cpp.

◆ proba

const auto& proba = softmax->getProbabilities()

Definition at line 139 of file wrapper_nnets.cpp.

◆ result

return result = jenv->NewFloatArray(proba.size())

Definition at line 140 of file wrapper_nnets.cpp.

◆ outptr

jfloat* outptr = jenv->GetFloatArrayElements(result, nullptr)

Definition at line 141 of file wrapper_nnets.cpp.

◆ rotation

JNIEnv jlong jint rotation
Initial value:

Definition at line 153 of file wrapper_nnets.cpp.

◆ jModel

JNIEnv jobject jModel

Definition at line 174 of file wrapper_nnets.cpp.

◆ jData

JNIEnv jobject jobject jData
Initial value:

Definition at line 174 of file wrapper_nnets.cpp.

◆ task

Definition at line 179 of file wrapper_nnets.cpp.

◆ jBitmap

JNIEnv jlong jobject jBitmap

Definition at line 187 of file wrapper_nnets.cpp.

◆ opName

JNIEnv jlong jobject jstring opName

Definition at line 187 of file wrapper_nnets.cpp.

◆ index

JNIEnv jlong jobject jlong jint index
Initial value:

Definition at line 187 of file wrapper_nnets.cpp.

◆ hOp

JNIEnv jlong jobject jlong hOp

Definition at line 203 of file wrapper_nnets.cpp.