1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

tensorflow liteのGPU実行を試したいけどビルド出来なかった時

Last updated at Posted at 2019-12-31

基本的には
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
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?