TFLITE_USE_DELEGATE has been changed to use GpuDelegateOptions instead of TFLGpuDelegateOptions.

When I tried to run the sample using the GPU-supported version of TensorFlow Lite, I encountered an exception on line 419 of tensorflow/lite/examples/ios/camera/CameraExampleViewController.mm.

The exceptions that occurred are as follows
"Unknown type name 'TFLGpuDelegateOptions'; did you mean 'GpuDelegateOptions'?"

Using GpuDelegateOptions seemed to be the right thing to do, so I modified the code to use this one.

Official tutorial: https://www.tensorflow.org/lite/performance/gpu#ios_with_xcode
This commit is contained in:
nyagato_00 2020-08-29 17:39:37 +09:00
parent a32c74ae8f
commit 8811098244

View File

@ -387,7 +387,7 @@ void ProcessInputWithQuantizedModel(
- (void)dealloc {
#if TFLITE_USE_GPU_DELEGATE
if (delegate) {
TFLGpuDelegateDelete(delegate);
DeleteGpuDelegate(delegate);
}
#endif
[self teardownAVCapture];
@ -416,10 +416,10 @@ void ProcessInputWithQuantizedModel(
tflite::InterpreterBuilder(*model, resolver)(&interpreter);
#if TFLITE_USE_GPU_DELEGATE
TFLGpuDelegateOptions options;
GpuDelegateOptions options;
options.allow_precision_loss = true;
options.wait_type = TFLGpuDelegateWaitTypeActive;
delegate = TFLGpuDelegateCreate(&options);
options.wait_type = GpuDelegateOptions::WaitType::kActive;
delegate = NewGpuDelegate(&options);
interpreter->ModifyGraphWithDelegate(delegate);
#endif