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
@ -113,13 +113,13 @@ TfLiteStatus DelegatePrepare(TfLiteContext* context,
|
||||
} // namespace
|
||||
|
||||
TfLiteDelegate* TfLiteDelegateFactory::CreateSimpleDelegate(
|
||||
std::unique_ptr<SimpleDelegateInterface> simple_delegate) {
|
||||
std::unique_ptr<SimpleDelegateInterface> simple_delegate, int64_t flag) {
|
||||
if (simple_delegate == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
auto delegate = new TfLiteDelegate();
|
||||
delegate->Prepare = &DelegatePrepare;
|
||||
delegate->flags = kTfLiteDelegateFlagsNone;
|
||||
delegate->flags = flag;
|
||||
delegate->CopyFromBufferHandle = nullptr;
|
||||
delegate->CopyToBufferHandle = nullptr;
|
||||
delegate->FreeBufferHandle = nullptr;
|
||||
|
@ -114,8 +114,12 @@ class TfLiteDelegateFactory {
|
||||
public:
|
||||
// Creates TfLiteDelegate from the provided SimpleDelegateInterface.
|
||||
// The returned TfLiteDelegate should be deleted using DeleteSimpleDelegate.
|
||||
// A simple usage of the flags bit mask:
|
||||
// CreateSimpleDelegate(..., kTfLiteDelegateFlagsAllowDynamicTensors |
|
||||
// kTfLiteDelegateFlagsRequirePropagatedShapes)
|
||||
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
|
||||
// from CreateSimpleDelegate.
|
||||
|
Loading…
Reference in New Issue
Block a user