|
ailia_tflite
1.2.4.0
|
公開メンバ関数 | |
| static Int32 | ailiaTFLiteGetEnvironmentCount (ref UInt64 env_count) |
| 利用可能な計算環境の数を取得します [詳解] | |
| static Int32 | ailiaTFLiteGetEnvironment (Int32[] env) |
| 計算環境の一覧を取得します [詳解] | |
| static Int32 | ailiaTFLiteCreate (ref IntPtr instance, byte[] tflite, UInt64 tflite_length, IntPtr pmalloc, IntPtr pmemcpy, IntPtr pfree, IntPtr phandle, Int32 env_id, Int32 memory_mode, UInt32 flags) |
| ailia TFLite runtimeのインスタンスを作成します。 [詳解] | |
| static void | ailiaTFLiteDestroy (IntPtr instance) |
| ailia TFLite runtimeのインスタンスを破棄します。 [詳解] | |
| static Int32 | ailiaTFLiteGetCpuFeatures (IntPtr instance, ref Int32 cpu_features) |
| 使用するCPU命令を取得します [詳解] | |
| static Int32 | ailiaTFLiteSetCpuFeatures (IntPtr instance, Int32 cpu_features) |
| 使用するCPU命令を設定します [詳解] | |
| static Int32 | ailiaTFLiteGetDeviceCount (IntPtr instance, ref UInt64 device_count) |
| 使用可能なデバイスの個数を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetDeviceName (IntPtr instance, Int32 device_idx, ref IntPtr name) |
| 指定したインデックスのデバイスの名前を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetDeviceExtraInfo (IntPtr instance, Int32 device_idx, ref IntPtr info) |
| 指定したインデックスのデバイスの詳細情報を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteSelectDevices (IntPtr instance, Int32[] device_idxes, UInt64 idx_count) |
| 使用するデバイスのインデックスを指定します。 [詳解] | |
| static Int32 | ailiaTFLiteGetSelectedDeviceIndexes (IntPtr instance, Int32[] device_idxes, ref UInt64 idx_count) |
| 使用するデバイスのインデックスおよび数を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteAllocateTensors (IntPtr instance) |
| ailia TFLite runtimeの内部バッファーの確保を行います [詳解] | |
| static Int32 | ailiaTFLiteResizeInputTensor (IntPtr instance, Int32 input_index, Int32[] shape, Int32 dim) |
| 指定した入力indexのTensorの形状を変更します [詳解] | |
| static Int32 | ailiaTFLiteGetNumberOfInputs (IntPtr instance, ref Int32 num_of_input_tensor) |
| tfliteモデルの入力Tensorの数を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetInputTensorIndex (IntPtr instance, ref Int32 tensor_index, Int32 input_index) |
| 入力TensorのindexからTensorのindexを取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetNumberOfOutputs (IntPtr instance, ref Int32 num_of_output_tensor) |
| tfliteモデルの出力Tensorの数を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetOutputTensorIndex (IntPtr instance, ref Int32 tensor_index, Int32 output_index) |
| 出力TensorのindexからTensorのindexを取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetTensorDimension (IntPtr instance, ref Int32 tensor_dim, Int32 tensor_index) |
| index番目のTensorの次元を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetTensorShape (IntPtr instance, Int32[] shape, Int32 tensor_index) |
| index番目のTensorの形状を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetTensorShapeSignature (IntPtr instance, Int32[] shape, Int32 tensor_index) |
| index番目のTensorの未確定な次元情報付き形状を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetTensorType (IntPtr instance, ref sbyte tensor_type, Int32 tensor_index) |
| index番目のTensorのデータタイプを取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetTensorBuffer (IntPtr instance, ref IntPtr buffer, Int32 tensor_index) |
| index番目のTensorのデータの格納バッファーを取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetTensorName (IntPtr instance, ref IntPtr name, Int32 tensor_index) |
| index番目のTensorの名前を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetTensorQuantizationCount (IntPtr instance, ref Int32 count, Int32 tensor_index) |
| index番目のTensorの量子化パラメーターの個数を取得します [詳解] | |
| static Int32 | ailiaTFLiteGetTensorQuantizationScale (IntPtr instance, float[] scale, Int32 tensor_index) |
| index番目のTensorの量子化パラメーターのスケールを取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetTensorQuantizationZeroPoint (IntPtr instance, Int64[] zero_point, Int32 tensor_index) |
| index番目のTensorの量子化パラメーターのゼロ点を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetTensorQuantizationQuantizedDimension (IntPtr instance, ref Int32 axis, Int32 tensor_index) |
| index番目のTensorの量子化パラメーターの軸を取得します。 [詳解] | |
| static Int32 | ailiaTFLitePredict (IntPtr instance) |
| 推論を行います。 [詳解] | |
| static Int32 | ailiaTFLiteGetNodeCount (IntPtr instance, ref Int32 count) |
| Nodeの個数を取得します [詳解] | |
| static Int32 | ailiaTFLiteGetNodeOperator (IntPtr instance, ref Int32 op, Int32 node_index) |
| node_index番目のNodeのOperatorを取得します [詳解] | |
| static Int32 | ailiaTFLiteGetNodeInputCount (IntPtr instance, ref Int32 count, Int32 node_index) |
| node_index番目のNodeの入力の個数を取得します [詳解] | |
| static Int32 | ailiaTFLiteGetNodeInputTensorIndex (IntPtr instance, ref Int32 tensor_index, Int32 node_index, Int32 input_index) |
| node_index番目のNodeのinput_index番目の入力のTensorのindexを取得します [詳解] | |
| static Int32 | ailiaTFLiteGetNodeOutputCount (IntPtr instance, ref Int32 count, Int32 node_index) |
| node_index番目のNodeの出力の個数を取得します [詳解] | |
| static Int32 | ailiaTFLiteGetNodeOutputTensorIndex (IntPtr instance, ref Int32 tensor_index, Int32 node_index, Int32 output_index) |
| node_index番目のNodeのoutput_index番目の出力のTensorのindexを取得します [詳解] | |
| static Int32 | ailiaTFLiteGetNodeOption (IntPtr instance, IntPtr value, Int32 node_index, string key) |
| node_index番目のNodeのオプションを取得します [詳解] | |
| static Int32 | ailiaTFLiteGetOperatorName (ref IntPtr name, Int32 op) |
| Operatorの名前を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteSetProfileMode (IntPtr instance, Int32 mode) |
| プロファイルモードをセットします。 [詳解] | |
| static Int32 | ailiaTFLiteGetSummaryLength (IntPtr instance, ref UInt64 buffer_size) |
| ネットワークSummary用に必要なバッファのサイズを取得します。 [詳解] | |
| static Int32 | ailiaTFLiteGetSummary (IntPtr instance, byte[] buffer, UInt64 buffer_size) |
| 各Nodeの名前と形状を表示します。 [詳解] | |
| static Int32 | ailiaTFLiteGetErrorDetail (IntPtr instance, ref IntPtr buffer) |
| エラーの詳細を返します [詳解] | |
| static Int32 | ailiaTFLiteSetScratchBuffer (IntPtr instance, IntPtr int_buffer, UInt64 int_buffer_size, IntPtr mid_buffer, UInt64 mid_buffer_size, IntPtr ext_buffer, UInt64 ext_buffer_size) |
| スクラッチバッファを設定します [詳解] | |
| static Int32 | ailiaTFLiteGetScratchBufferUsage (IntPtr instance, ref UInt64 int_buffer_size, ref UInt64 mid_buffer_size, ref UInt64 ext_buffer_size) |
| スクラッチバッファの最大使用量を取得します。 [詳解] | |
| static Int32 | ailiaTFLiteMklSetNumThreads (Int32 num_threads) |
| MKLが使用するスレッド数を設定します [詳解] | |
| static Int32 | ailiaTFLiteMklDisableFastMM () |
| MKLのFastMMを無効化します [詳解] | |
| static IntPtr | ailiaTFLiteGetVersion () |
| ライブラリバージョンを取得します。 [詳解] | |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteAllocateTensors | ( | IntPtr | instance | ) |
ailia TFLite runtimeの内部バッファーの確保を行います
| instance | ailia TFLite runtimeインスタンスポインター |
内部の形状を更新し、推論に必要なバッファーを確保します。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteCreate | ( | ref IntPtr | instance, |
| byte[] | tflite, | ||
| UInt64 | tflite_length, | ||
| IntPtr | pmalloc, | ||
| IntPtr | pmemcpy, | ||
| IntPtr | pfree, | ||
| IntPtr | phandle, | ||
| Int32 | env_id, | ||
| Int32 | memory_mode, | ||
| UInt32 | flags | ||
| ) |
ailia TFLite runtimeのインスタンスを作成します。
| instance | ailia TFLite runtimeインスタンスポインターへのポインター |
| tflite | tfliteモデルへのポインター |
| tflite_length | tfliteの長さ(バイト単位) |
| pmalloc | mallocの関数ポインター(NULLの場合はmallocを利用) |
| pmemcpy | memcpyの関数ポインター(NULLの場合はmemcpyを利用) |
| pfree | freeの関数ポインター(NULLの場合はfreeを利用) |
| phandle | メモリアロケータに渡されるハンドル(標準のアロケータを使用する場合はNULL) |
| env_id | 計算に利用する推論実行環境(AILIA_TFLITE_ENV_NNAPI_*) |
| memory_mode | メモリモード(AILIA_TFLITE_MEMORY_MODE_*) |
| flags | フラグ(AILIA_TFLITE_FLAG_*の論理和) |
tfliteモデルを開き、ailia TFLite runtimeインスタンスを作成します。 また、必要な内部バッファーの確保も行います。 インスタンス生成に失敗した場合でinstanceにNULL以外が格納された場合はailiaTFLiteDestroyを呼び出す必要があります。
| static void ailiaTFLite.AiliaTFLite.ailiaTFLiteDestroy | ( | IntPtr | instance | ) |
ailia TFLite runtimeのインスタンスを破棄します。
| instance | ailia TFLite runtimeインスタンスポインター |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetCpuFeatures | ( | IntPtr | instance, |
| ref Int32 | cpu_features | ||
| ) |
使用するCPU命令を取得します
| instance | ailia TFLite runtimeインスタンスポインター |
| cpu_features | AILIA_TFLITE_CPU_FEATURES_XXXの論理和 |
使用するCPU命令を取得します。 デフォルトではCPU情報から取得したCPU命令を返します。 ailiaTFLiteSetCpuFeaturesを呼び出した以降は、設定したCPU命令を返します。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetDeviceCount | ( | IntPtr | instance, |
| ref UInt64 | device_count | ||
| ) |
使用可能なデバイスの個数を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| device_count | デバイス数の格納先 |
使用可能なデバイスの個数を取得します。 ailiaTFLiteCreate()で指定するenv_idがNNAPI時のみ、動作可能です。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetDeviceExtraInfo | ( | IntPtr | instance, |
| Int32 | device_idx, | ||
| ref IntPtr | info | ||
| ) |
指定したインデックスのデバイスの詳細情報を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| device_idx | ailiaTFLiteGetDeviceCount() で取得した数の中の、インデックス番号 |
| info | デバイスの詳細情報の文字列の格納先 |
指定したインデックスのデバイスの詳細情報を取得します。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetDeviceName | ( | IntPtr | instance, |
| Int32 | device_idx, | ||
| ref IntPtr | name | ||
| ) |
指定したインデックスのデバイスの名前を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| device_idx | ailiaTFLiteGetDeviceCount() で取得した数の中の、インデックス番号 |
| name | デバイスの名前の文字列の格納先 |
指定したインデックスのデバイスの名前を取得します。 ailiaTFLiteCreate()で指定するenv_idがNNAPI時のみ、動作可能です。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetEnvironment | ( | Int32[] | env | ) |
計算環境の一覧を取得します
| env | 計算環境情報の格納先の配列 |
ailiaTFLiteGetEnvironmentCount()の返すサイズの配列を入力に渡してください。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetEnvironmentCount | ( | ref UInt64 | env_count | ) |
利用可能な計算環境の数を取得します
| env_count | 計算環境情報の数の格納先へのポインター |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetErrorDetail | ( | IntPtr | instance, |
| ref IntPtr | buffer | ||
| ) |
エラーの詳細を返します
| instance | ailia TFLite runtimeインスタンスポインター |
| buffer | エラー詳細文字列へのポインタ |
文字列は解放する必要はありません。 文字列の有効期間は次にailiaのAPIを呼ぶまでとなります。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetInputTensorIndex | ( | IntPtr | instance, |
| ref Int32 | tensor_index, | ||
| Int32 | input_index | ||
| ) |
入力TensorのindexからTensorのindexを取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| tensor_index | Tensorのindexの格納先へのポインター |
| input_index | 入力Tensorのindex(0~入力Tensorの数-1) |
入力TensorのindexからTensorのindexに変換します。 indexの上限はailiaTFLiteGetNumberOfInputs()-1です。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetNodeCount | ( | IntPtr | instance, |
| ref Int32 | count | ||
| ) |
Nodeの個数を取得します
| instance | ailia TFLite runtimeインスタンスポインター |
| count | Nodeの個数の格納先へのポインター |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetNodeInputCount | ( | IntPtr | instance, |
| ref Int32 | count, | ||
| Int32 | node_index | ||
| ) |
node_index番目のNodeの入力の個数を取得します
| instance | ailia TFLite runtimeインスタンスポインター |
| count | 入力の個数の格納先へのポインター |
| node_index | Nodeのindex |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetNodeInputTensorIndex | ( | IntPtr | instance, |
| ref Int32 | tensor_index, | ||
| Int32 | node_index, | ||
| Int32 | input_index | ||
| ) |
node_index番目のNodeのinput_index番目の入力のTensorのindexを取得します
| instance | ailia TFLite runtimeインスタンスポインター |
| tensor_index | Tensorのindexの格納先へのポインター |
| node_index | Nodeのindex |
| input_index | 入力のindex |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetNodeOperator | ( | IntPtr | instance, |
| ref Int32 | op, | ||
| Int32 | node_index | ||
| ) |
node_index番目のNodeのOperatorを取得します
| instance | ailia TFLite runtimeインスタンスポインター |
| op | Operatorの格納先へのポインター |
| node_index | Nodeのindex |
Operatorのenum値はtfliteファイルの内部の値に準じます。 詳しくはTensorFlowのソースツリーのtensorflow/lite/schema/schema.fbsファイルを参照してください。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetNodeOption | ( | IntPtr | instance, |
| IntPtr | value, | ||
| Int32 | node_index, | ||
| string | key | ||
| ) |
node_index番目のNodeのオプションを取得します
| instance | ailia TFLite runtimeインスタンスポインター |
| value | 出力の格納先へのポインター |
| node_index | Nodeのindex |
| key | オプション名の文字列ポインター |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetNodeOutputCount | ( | IntPtr | instance, |
| ref Int32 | count, | ||
| Int32 | node_index | ||
| ) |
node_index番目のNodeの出力の個数を取得します
| instance | ailia TFLite runtimeインスタンスポインター |
| count | 出力の個数の格納先へのポインター |
| node_index | Nodeのindex |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetNodeOutputTensorIndex | ( | IntPtr | instance, |
| ref Int32 | tensor_index, | ||
| Int32 | node_index, | ||
| Int32 | output_index | ||
| ) |
node_index番目のNodeのoutput_index番目の出力のTensorのindexを取得します
| instance | ailia TFLite runtimeインスタンスポインター |
| tensor_index | Tensorのindexの格納先へのポインター |
| node_index | Nodeのindex |
| output_index | 出力のindex |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetNumberOfInputs | ( | IntPtr | instance, |
| ref Int32 | num_of_input_tensor | ||
| ) |
tfliteモデルの入力Tensorの数を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| num_of_input_tensor | モデルの入力Tensorの数の格納先へのポインター |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetNumberOfOutputs | ( | IntPtr | instance, |
| ref Int32 | num_of_output_tensor | ||
| ) |
tfliteモデルの出力Tensorの数を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| num_of_output_tensor | モデルの出力Tensorの数の格納先へのポインター |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetOperatorName | ( | ref IntPtr | name, |
| Int32 | op | ||
| ) |
Operatorの名前を取得します。
| name | Operatorの名前の文字列ポインターの格納先へのポインター |
| op | Operator |
nameで取得できる文字列ポインターの寿命はライブラリのアンロードまで有効です。 なお、呼び出し元で文字列ポインターを開放する必要はありません。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetOutputTensorIndex | ( | IntPtr | instance, |
| ref Int32 | tensor_index, | ||
| Int32 | output_index | ||
| ) |
出力TensorのindexからTensorのindexを取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| tensor_index | Tensorのindexの格納先へのポインター |
| output_index | 出力Tensorのindex(0~出力Tensorの数-1) |
出力TensorのindexからTensorのindexに変換します。 indexの上限はailiaTFLiteGetNumberOfOutputs()-1です。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetScratchBufferUsage | ( | IntPtr | instance, |
| ref UInt64 | int_buffer_size, | ||
| ref UInt64 | mid_buffer_size, | ||
| ref UInt64 | ext_buffer_size | ||
| ) |
スクラッチバッファの最大使用量を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| int_buffer_size | スクラッチバッファ(L2)のサイズ |
| mid_buffer_size | スクラッチバッファ(MSMC)のサイズ |
| ext_buffer_size | スクラッチバッファ(DDR)のサイズ |
初回に大きいスクラッチバッファサイズで推論を行うことで、必要なスクラッチバッファのサイズを取得することができます。 内部で行われるアライメントを考慮した値が返るため、取得した値はアライメントを考慮せずに直接使用可能です。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetSelectedDeviceIndexes | ( | IntPtr | instance, |
| Int32[] | device_idxes, | ||
| ref UInt64 | idx_count | ||
| ) |
使用するデバイスのインデックスおよび数を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| device_idxes | インデックスを格納する配列。ailiaTFLiteGetDeviceCount()で取得する数を最大数とする配列を用意してください。 |
| idx_count | 配列の数の格納先 |
使用するデバイスのインデックスおよび数を取得します。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetSummary | ( | IntPtr | instance, |
| byte[] | buffer, | ||
| UInt64 | buffer_size | ||
| ) |
各Nodeの名前と形状を表示します。
| instance | ailia TFLite runtimeインスタンスポインター |
| buffer | Summaryの出力先の文字列ポインター |
| buffer_size | 出力バッファのサイズ(終端null文字分を含む)。 ailiaTFLiteGetSummaryLength() で取得した値を設定してください。 |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetSummaryLength | ( | IntPtr | instance, |
| ref UInt64 | buffer_size | ||
| ) |
ネットワークSummary用に必要なバッファのサイズを取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| buffer_size | バッファのサイズの格納先へのポインター(終端null文字分を含む) |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorBuffer | ( | IntPtr | instance, |
| ref IntPtr | buffer, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorのデータの格納バッファーを取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| buffer | データの格納バッファーへのポインターの格納先へのポインター |
| tensor_index | Tensorのindex |
bufferで取得できる格納バッファーの寿命はailiaTFLiteAllocateTensors/ailiaTFLiteResizeInputTensor/ailiaTFLiteDestroyのいずれか呼び出すまで有効です。 また、格納バッファーの値はailiaTFLitePredictを呼び出すと変更されます。 なお、呼び出し元で格納バッファーを開放する必要はありません。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorDimension | ( | IntPtr | instance, |
| ref Int32 | tensor_dim, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorの次元を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| tensor_dim | 指定したTensorの次元の格納先へのポインター |
| tensor_index | Tensorのindex |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorName | ( | IntPtr | instance, |
| ref IntPtr | name, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorの名前を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| name | Tensorの名前の文字列ポインターの格納先へのポインター |
| tensor_index | Tensorのindex |
nameで取得できる文字列ポインターの寿命はailiaTFLiteDestroyを呼び出すまで有効です。 なお、呼び出し元で文字列ポインターを開放する必要はありません。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorQuantizationCount | ( | IntPtr | instance, |
| ref Int32 | count, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorの量子化パラメーターの個数を取得します
| instance | ailia TFLite runtimeインスタンスポインター |
| count | 量子化パラメーターの個数の格納先へのポインター |
| tensor_index | Tensorのindex |
指定したTensorに関連付けられた量子化パラメーターの個数を取得します。 指定したTensorに量子化パラメーターが存在しない場合は0が格納されます。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorQuantizationQuantizedDimension | ( | IntPtr | instance, |
| ref Int32 | axis, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorの量子化パラメーターの軸を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| axis | 量子化パラメーターの軸の格納先へのポインター |
| tensor_index | Tensorのindex |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorQuantizationScale | ( | IntPtr | instance, |
| float[] | scale, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorの量子化パラメーターのスケールを取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| scale | 量子化パラメーターのスケールの格納先へのポインター |
| tensor_index | Tensorのindex |
Tensorは以下の式で量子化して格納します。 量子化値 = zero_point * round(入力/scale) scale:ailiaTFLiteGetTensorQuantizationScaleで取得 zero_point:ailiaTFLiteGetTensorQuantizationZeroPointで取得 scaleはailiaTFLiteGetTensorQuantizationCountで取得した要素数以上のバッファーを確保してください。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorQuantizationZeroPoint | ( | IntPtr | instance, |
| Int64[] | zero_point, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorの量子化パラメーターのゼロ点を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| zero_point | 量子化パラメーターのゼロ点の格納先へのポインター |
| tensor_index | Tensorのindex |
量子化の解説はailiaTFLiteGetTensorQuantizationScaleを御覧ください。 zero_pointはailiaTFLiteGetTensorQuantizationCountで取得した要素数以上のバッファーを確保してください。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorShape | ( | IntPtr | instance, |
| Int32[] | shape, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorの形状を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| shape | Tensorの形状の格納先 |
| tensor_index | Tensorのindex |
指定したTensorの形状をshapeに格納します。 shapeはailiaTFLiteGetTensorDimensionで取得した次元以上のバッファーを確保してください。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorShapeSignature | ( | IntPtr | instance, |
| Int32[] | shape, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorの未確定な次元情報付き形状を取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| shape | Tensorの形状の格納先 |
| tensor_index | Tensorのindex |
指定したTensorの未確定な次元情報付き形状をshapeに格納します。 形状が未確定な次元は-1が格納されます。 指定したTensorに未確定な次元が含まれていない場合はailiaTFLiteGetTensorShapeと同じ結果となります。 shapeはailiaTFLiteGetTensorDimensionで取得した次元以上のバッファーを確保してください。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteGetTensorType | ( | IntPtr | instance, |
| ref sbyte | tensor_type, | ||
| Int32 | tensor_index | ||
| ) |
index番目のTensorのデータタイプを取得します。
| instance | ailia TFLite runtimeインスタンスポインター |
| tensor_type | 指定したTensorのデータタイプの格納先 |
| tensor_index | Tensorのindex |
| static IntPtr ailiaTFLite.AiliaTFLite.ailiaTFLiteGetVersion | ( | ) |
ライブラリバージョンを取得します。
返値は解放する必要はありません。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteMklDisableFastMM | ( | ) |
MKLのFastMMを無効化します
mkl_disable_fast_mmを呼び出すことでFastMMを無効化します。全てのインスタンスに影響します。 MKLはスレッドごとにメモリを確保するため、mkl_free_buffersを呼び出すまでメモリが単調増加します。 このワークメモリは、ailiaTFLiteDestroyでmkl_free_buffersを呼び出すまで保持されます。 FastMMを無効化することで、スレッドごとにメモリを確保しないように指定することができます。 MKLを使用しない環境(macOSなど)ではAILIA_TFLITE_STATUS_INVALID_STATEを返します。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteMklSetNumThreads | ( | Int32 | num_threads | ) |
MKLが使用するスレッド数を設定します
| num_threads | スレッド数(1以上) |
mkl_set_num_threadsを呼び出すことでMKLのスレッド数を変更します。全てのインスタンスに影響します。 デフォルトでは自動設定となります。 MKLを使用しない環境(macOSなど)ではAILIA_TFLITE_STATUS_INVALID_STATEを返します。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLitePredict | ( | IntPtr | instance | ) |
推論を行います。
| instance | ailia TFLite runtimeインスタンスポインター |
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteResizeInputTensor | ( | IntPtr | instance, |
| Int32 | input_index, | ||
| Int32[] | shape, | ||
| Int32 | dim | ||
| ) |
指定した入力indexのTensorの形状を変更します
| instance | ailia TFLite runtimeインスタンスポインター |
| input_index | 0~入力Tensorの数-1 |
| shape | 新しい形状 |
| dim | 次元 |
入力Tensorの形状を変更します。 この関数を呼び出すと確保済み内部バッファーを開放するため、 ailiaTFLiteAllocateTensorsを呼び出す必要があります。 また、入力形状に応じて中間Tensorの形状が変わる場合があるため、 この関数を呼出後、ailiaTFLiteAllocateTensorsを呼び出すまでは取得系APIの結果が不正となる場合があります。 indexの上限はailiaTFLiteGetNumberOfInputs()-1です。 なお、指定したTensorに未確定な次元が含まれていない場合(ailiaTFLiteGetTensorShapeSignatureで取得したshapeに-1が含まれていない場合)はエラーとなります。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteSelectDevices | ( | IntPtr | instance, |
| Int32[] | device_idxes, | ||
| UInt64 | idx_count | ||
| ) |
使用するデバイスのインデックスを指定します。
| instance | ailia TFLite runtimeインスタンスポインター |
| device_idxes | インデックス番号を格納した配列 |
| idx_count | 配列の数 |
使用するデバイスのインデックスを指定します。複数指定可能です。 NNAPIにはDSP実装されていないオペレータが存在します。 そのため、DSPとCPUの両方を指定することで非対応オペレータをCPUにオフロードする必要があります。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteSetCpuFeatures | ( | IntPtr | instance, |
| Int32 | cpu_features | ||
| ) |
使用するCPU命令を設定します
| instance | ailia TFLite runtimeインスタンスポインター |
| cpu_features | AILIA_TFLITE_CPU_FEATURES_XXXの論理和 |
使用するCPU命令を設定します。 使用できないCPU命令が設定された場合、AILIA_TFLITE_STATUS_OUT_OF_RANGEを返します。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteSetProfileMode | ( | IntPtr | instance, |
| Int32 | mode | ||
| ) |
プロファイルモードをセットします。
| instance | ailia TFLite runtimeインスタンスポインター |
| mode | プロファイルモード (AILIA_TFLITE_PROFILE_MODE_*) |
プロファイルモードを指定します。デフォルトは無効です。 プロファイルモードを有効にした場合、ailiaTFLiteGetSummaryの出力にプロファイル結果が追加されます。 ailiaTFLiteCreateの直後に実行する必要があります。 ailiaTFLiteAllocateTensorsの後に呼び出した場合はAILIA_TFLITE_STATUS_INVALID_STATEが返ります。
| static Int32 ailiaTFLite.AiliaTFLite.ailiaTFLiteSetScratchBuffer | ( | IntPtr | instance, |
| IntPtr | int_buffer, | ||
| UInt64 | int_buffer_size, | ||
| IntPtr | mid_buffer, | ||
| UInt64 | mid_buffer_size, | ||
| IntPtr | ext_buffer, | ||
| UInt64 | ext_buffer_size | ||
| ) |
スクラッチバッファを設定します
| instance | ailia TFLite runtimeインスタンスポインター |
| int_buffer | スクラッチバッファ(L2)へのポインタ |
| int_buffer_size | スクラッチバッファ(L2)のサイズ(64byte以上) |
| mid_buffer | スクラッチバッファ(MSMC)へのポインタ |
| mid_buffer_size | スクラッチバッファ(MSMC)のサイズ |
| ext_buffer | スクラッチバッファ(DDR)へのポインタ |
| ext_buffer_size | スクラッチバッファ(DDR)のサイズ |
MMALIBで使用するスクラッチバッファを設定します。ENV_MMALIBを指定した場合のみ有効です。 バッファのアライメントは内部で行われるため、アライメントを考慮する必要はありません。 L2以外のバッファサイズに0を指定すると、指定したバッファを無効化することが可能です。 ENV_MMALIBを指定した場合に、この関数を呼び出さずにailiaTFLiteAllocateTensorsを実行すると、AILIA_TFLITE_STATUS_INVALID_STATEを返します。 スクラッチバッファはailiaTFLitePredictを呼び出す度に変更することが可能です。 ただし、スクラッチバッファのサイズはailiaTFLiteAllocateTensorsで使用した値と同じである必要があります。 非永続化データのワーク領域として使用するため、シングルスレッドの場合は複数インスタンスに同じバッファを与えることが可能です。
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |