MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CreateGPUDelegate

Function CreateGPUDelegate

tensorflow/lite/examples/label_image/label_image.cc:58–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56using TfLiteDelegatePtrMap = std::map<std::string, TfLiteDelegatePtr>;
57
58TfLiteDelegatePtr 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
77TfLiteDelegatePtrMap GetDelegates(Settings* s) {
78 TfLiteDelegatePtrMap delegates;

Callers 1

GetDelegatesFunction · 0.70

Calls 3

GetModelMethod · 0.45

Tested by

no test coverage detected