Expose the TfLiteDelegateFlags params for simple delegate creation. This allows more flexibility for example users want to implement a delegate takes in custom op.
PiperOrigin-RevId: 341749773 Change-Id: I89ece3af61750fded53c810d3aa63ba0aafb9740
This commit is contained in:
parent
24d1fba948
commit
696102807d
tensorflow/lite/delegates/utils
@ -113,13 +113,13 @@ TfLiteStatus DelegatePrepare(TfLiteContext* context,
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TfLiteDelegate* TfLiteDelegateFactory::CreateSimpleDelegate(
|
TfLiteDelegate* TfLiteDelegateFactory::CreateSimpleDelegate(
|
||||||
std::unique_ptr<SimpleDelegateInterface> simple_delegate) {
|
std::unique_ptr<SimpleDelegateInterface> simple_delegate, int64_t flag) {
|
||||||
if (simple_delegate == nullptr) {
|
if (simple_delegate == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto delegate = new TfLiteDelegate();
|
auto delegate = new TfLiteDelegate();
|
||||||
delegate->Prepare = &DelegatePrepare;
|
delegate->Prepare = &DelegatePrepare;
|
||||||
delegate->flags = kTfLiteDelegateFlagsNone;
|
delegate->flags = flag;
|
||||||
delegate->CopyFromBufferHandle = nullptr;
|
delegate->CopyFromBufferHandle = nullptr;
|
||||||
delegate->CopyToBufferHandle = nullptr;
|
delegate->CopyToBufferHandle = nullptr;
|
||||||
delegate->FreeBufferHandle = nullptr;
|
delegate->FreeBufferHandle = nullptr;
|
||||||
|
@ -114,8 +114,12 @@ class TfLiteDelegateFactory {
|
|||||||
public:
|
public:
|
||||||
// Creates TfLiteDelegate from the provided SimpleDelegateInterface.
|
// Creates TfLiteDelegate from the provided SimpleDelegateInterface.
|
||||||
// The returned TfLiteDelegate should be deleted using DeleteSimpleDelegate.
|
// The returned TfLiteDelegate should be deleted using DeleteSimpleDelegate.
|
||||||
|
// A simple usage of the flags bit mask:
|
||||||
|
// CreateSimpleDelegate(..., kTfLiteDelegateFlagsAllowDynamicTensors |
|
||||||
|
// kTfLiteDelegateFlagsRequirePropagatedShapes)
|
||||||
static TfLiteDelegate* CreateSimpleDelegate(
|
static TfLiteDelegate* CreateSimpleDelegate(
|
||||||
std::unique_ptr<SimpleDelegateInterface> simple_delegate);
|
std::unique_ptr<SimpleDelegateInterface> simple_delegate,
|
||||||
|
int64_t flags = kTfLiteDelegateFlagsNone);
|
||||||
|
|
||||||
// Deletes 'delegate' the passed pointer must be the one returned
|
// Deletes 'delegate' the passed pointer must be the one returned
|
||||||
// from CreateSimpleDelegate.
|
// from CreateSimpleDelegate.
|
||||||
|
Loading…
Reference in New Issue
Block a user