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:
parent
a32c74ae8f
commit
8811098244
@ -387,7 +387,7 @@ void ProcessInputWithQuantizedModel(
|
|||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
#if TFLITE_USE_GPU_DELEGATE
|
#if TFLITE_USE_GPU_DELEGATE
|
||||||
if (delegate) {
|
if (delegate) {
|
||||||
TFLGpuDelegateDelete(delegate);
|
DeleteGpuDelegate(delegate);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
[self teardownAVCapture];
|
[self teardownAVCapture];
|
||||||
@ -416,10 +416,10 @@ void ProcessInputWithQuantizedModel(
|
|||||||
tflite::InterpreterBuilder(*model, resolver)(&interpreter);
|
tflite::InterpreterBuilder(*model, resolver)(&interpreter);
|
||||||
|
|
||||||
#if TFLITE_USE_GPU_DELEGATE
|
#if TFLITE_USE_GPU_DELEGATE
|
||||||
TFLGpuDelegateOptions options;
|
GpuDelegateOptions options;
|
||||||
options.allow_precision_loss = true;
|
options.allow_precision_loss = true;
|
||||||
options.wait_type = TFLGpuDelegateWaitTypeActive;
|
options.wait_type = GpuDelegateOptions::WaitType::kActive;
|
||||||
delegate = TFLGpuDelegateCreate(&options);
|
delegate = NewGpuDelegate(&options);
|
||||||
interpreter->ModifyGraphWithDelegate(delegate);
|
interpreter->ModifyGraphWithDelegate(delegate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user