基本的には
https://www.tensorflow.org/lite/performance/gpu
を呼んでいけばいいのだけど、今はこの通りにやってもビルド出来ない。
次のような変更があり、一部のクラスが変わっている
https://github.com/tensorflow/tensorflow/commit/23a967474a3f1823235ab4201fd27e4dcd5725d6#diff-8eb564dd0ef4c2d24e69c2aa523bd047
CameraExampleViewController.mmを次のように変更すれば良い
- (void)dealloc {
# if TFLITE_USE_GPU_DELEGATE
if (delegate) {
+ DeleteGpuDelegate(delegate);
- TFLGpuDelegateDelete(delegate);
}
# endif
[self teardownAVCapture];
}
# if TFLITE_USE_GPU_DELEGATE
- TFLGpuDelegateOptions options;
- options.allow_precision_loss = true;
- options.wait_type = TFLGpuDelegateWaitTypeActive;
- delegate = TFLGpuDelegateCreate(&options);
- interpreter->ModifyGraphWithDelegate(delegate);
+ GpuDelegateOptions options;
+ options.allow_precision_loss = true;
+ options.wait_type = GpuDelegateOptions::WaitType::kActive;
+ delegate = NewGpuDelegate(&options);
+ interpreter->ModifyGraphWithDelegate(delegate);
# endif