| 56 | using TfLiteDelegatePtrMap = std::map<std::string, TfLiteDelegatePtr>; |
| 57 | |
| 58 | TfLiteDelegatePtr CreateGPUDelegate(Settings* s) { |
| 59 | #if defined(__ANDROID__) |
| 60 | TfLiteGpuDelegateOptions options = TfLiteGpuDelegateOptionsDefault(); |
| 61 | options.metadata = TfLiteGpuDelegateGetModelMetadata(s->model->GetModel()); |
| 62 | if (s->allow_fp16) { |
| 63 | options.compile_options.precision_loss_allowed = 1; |
| 64 | } else { |
| 65 | options.compile_options.precision_loss_allowed = 0; |
| 66 | } |
| 67 | options.compile_options.preferred_gl_object_type = |
| 68 | TFLITE_GL_OBJECT_TYPE_FASTEST; |
| 69 | options.compile_options.dynamic_batch_enabled = 0; |
| 70 | |
| 71 | return evaluation::CreateGPUDelegate(s->model, &options); |
| 72 | #else |
| 73 | return evaluation::CreateGPUDelegate(s->model); |
| 74 | #endif |
| 75 | } |
| 76 | |
| 77 | TfLiteDelegatePtrMap GetDelegates(Settings* s) { |
| 78 | TfLiteDelegatePtrMap delegates; |
no test coverage detected