| java.lang.Object | |
| ↳ | com.samsung.android.knox.ex.knoxAI.KnoxAiSession |
Deprecated
in API level 37
NOTE: This Class is not available since Android 15.
Class of managing Knox AI Session.
| API level 34 |
| KNOX 3.7.1 |
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| KnoxAiSession.CompUnit |
Deprecated
in API level 37 NOTE: This Class is not available since Android 15. |
||||||||||
| KnoxAiSession.DataFormat |
Deprecated
in API level 37 NOTE: This Class is not available since Android 15. |
||||||||||
| KnoxAiSession.DataType |
Deprecated
in API level 37 NOTE: This Class is not available since Android 15. |
||||||||||
| KnoxAiSession.ExecType |
Deprecated
in API level 37 NOTE: This Class is not available since Android 15. |
||||||||||
| KnoxAiSession.Mode |
Deprecated
in API level 37 NOTE: This Class is not available since Android 15. |
||||||||||
| KnoxAiSession.ModelInputType |
Deprecated
in API level 37 NOTE: This Class is not available since Android 15. |
||||||||||
| KnoxAiSession.ModelType |
Deprecated
in API level 37 NOTE: This Class is not available since Android 15. |
||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Deprecated
in API level 37
NOTE: This Class is not available since Android 15. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Deprecated
in API level 37
NOTE: This Class is not available since Android 15. | |||||||||||
Deprecated
in API level 37
NOTE: This Class is not available since Android 15. | |||||||||||
Deprecated
in API level 37
NOTE: This Class is not available since Android 15. | |||||||||||
Deprecated
in API level 37
NOTE: This Class is not available since Android 15. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Deprecated
in API level 37
NOTE: This Class is not available since Android 15.
Default Constructor
| API level 34 |
| KNOX 3.7.1 |
Deprecated
in API level 37
NOTE: This Class is not available since Android 15.
Closes the current Knox AI session.
| SecurityException |
Called at the end of AI model execution to release the instance of session.
int status = -1;
status = session.close();
|
| com.samsung.android.knox.permission.KNOX_NDA_AI |
| API level 34 |
| KNOX 3.7.1 |
| User Scope |
KnoxAiSession
Deprecated
in API level 37
NOTE: This Class is not available since Android 15.
Executes the AI model using the given inputs and outputs the result of execution.
| SecurityException |
Called after the session is opened to execute AI model.
DataBuffer[] input = new DataBuffer[1];
DataBuffer[] output = new DataBuffer[1];
DataBuffer dB = new DataBuffer();
dB.setDataType((byte) 0);
dB.setDataFormat((byte) 1);
int[] shape = new int[]{1, 224, 224, 3};
dB.setShape(shape);
dB.setDataSource((byte)2);
try {
SharedMemory sharedMemory = SharedMemory.create("data", indata.length * 4);
ByteBuffer bBuffer = sharedMemory.mapReadWrite();
byte[] bytes = DataBuffer.readFloatToBytes(indata);
bBuffer.put(bytes);
dB.setDataShared(sharedMemory);
} catch (ErrnoException e) {
e.printStackTrace();
}
input[0] = dB;
status = session.execute(input, output);
if (output != null && output.length > 0 ) {
if (output[0].getDataSource() == 0) {
float[] outputData = output[0].getDataOriginal();
}
}
|
| com.samsung.android.knox.permission.KNOX_NDA_AI |
| API level 34 |
| KNOX 3.7.1 |
| User Scope |
Deprecated
in API level 37
NOTE: This Class is not available since Android 15.
Gets the dimensions of input data based on the AI model.
| SecurityException |
Called before execute API to get the expected input dimensions.
int status = -1;
int[] inputShape = new int[4];
status = session.getModelInputShape(0, inputShape);
|
| com.samsung.android.knox.permission.KNOX_NDA_AI |
| API level 34 |
| KNOX 3.7.1 |
| User Scope |
Deprecated
in API level 37
NOTE: This Class is not available since Android 15.
Opens the Knox AI session and loads the AI model using the given KfaOptions.
| SecurityException |
Called at beginning before AI model execution to load the model.
KfaOptions options = new KfaOptions();
options.setExecType(0);
options.setCompUnit(0);
options.setmType(4);
ArrayList |
| com.samsung.android.knox.permission.KNOX_NDA_AI |
| API level 34 |
| KNOX 3.7.1 |
| User Scope |