Add portable (no-op) version of StatefulNnApiDelegate
PiperOrigin-RevId: 249683139
This commit is contained in:
parent
bb8e8b77e9
commit
9a0e7946a7
@ -19,17 +19,21 @@ namespace tflite {
|
||||
|
||||
// Return a non-functional NN API Delegate struct.
|
||||
TfLiteDelegate* NnApiDelegate() {
|
||||
static TfLiteDelegate delegate = [] {
|
||||
TfLiteDelegate delegate = TfLiteDelegateCreate();
|
||||
delegate.Prepare = [](TfLiteContext* context,
|
||||
TfLiteDelegate* delegate) -> TfLiteStatus {
|
||||
// Silently succeed without modifying the graph.
|
||||
return kTfLiteOk;
|
||||
};
|
||||
return delegate;
|
||||
}();
|
||||
static StatefulNnApiDelegate* delegate = new StatefulNnApiDelegate();
|
||||
return delegate;
|
||||
}
|
||||
|
||||
return &delegate;
|
||||
StatefulNnApiDelegate::StatefulNnApiDelegate(Options /* options */)
|
||||
: StatefulNnApiDelegate() {}
|
||||
|
||||
StatefulNnApiDelegate::StatefulNnApiDelegate()
|
||||
: TfLiteDelegate(TfLiteDelegateCreate()) {
|
||||
Prepare = DoPrepare;
|
||||
}
|
||||
|
||||
TfLiteStatus StatefulNnApiDelegate::DoPrepare(TfLiteContext* /* context */,
|
||||
TfLiteDelegate* /* delegate */) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
} // namespace tflite
|
||||
|
Loading…
x
Reference in New Issue
Block a user