From 6aa1ec8e8e4d4628a6765926fec6db48dcaf1ec1 Mon Sep 17 00:00:00 2001 From: TFLM-bot Date: Mon, 12 Jan 2026 14:05:22 +0000 Subject: [PATCH] Sync from upstream TF. --- tensorflow/lite/core/api/flatbuffer_conversions.cc | 13 ++++++++++++- tensorflow/lite/core/api/flatbuffer_conversions.h | 3 +++ tensorflow/lite/core/c/common.h | 10 +++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/tensorflow/lite/core/api/flatbuffer_conversions.cc b/tensorflow/lite/core/api/flatbuffer_conversions.cc index 35e6d6d534a..76d03a7fd89 100644 --- a/tensorflow/lite/core/api/flatbuffer_conversions.cc +++ b/tensorflow/lite/core/api/flatbuffer_conversions.cc @@ -487,6 +487,10 @@ TfLiteStatus ParseOpDataTfLite(const Operator* op, BuiltinOperator op_type, return ParseRsqrt(op, error_reporter, allocator, builtin_data); } + case BuiltinOperator_SELECT: { + return ParseSelect(op, error_reporter, allocator, builtin_data); + } + case BuiltinOperator_SELECT_V2: { return ParseSelectV2(op, error_reporter, allocator, builtin_data); } @@ -1004,7 +1008,6 @@ TfLiteStatus ParseOpDataTfLite(const Operator* op, BuiltinOperator op_type, case BuiltinOperator_RELU_N1_TO_1: case BuiltinOperator_RELU_0_TO_1: case BuiltinOperator_SCATTER_ND: - case BuiltinOperator_SELECT: case BuiltinOperator_SLICE: case BuiltinOperator_TILE: case BuiltinOperator_TOPK_V2: @@ -2509,6 +2512,14 @@ TfLiteStatus ParseRsqrt(const Operator*, ErrorReporter*, BuiltinDataAllocator*, return kTfLiteOk; } +// We have this parse function instead of directly returning kTfLiteOk from the +// switch-case in ParseOpData because this function is used as part of the +// selective registration for the OpResolver implementation in micro. +TfLiteStatus ParseSelect(const Operator*, ErrorReporter*, BuiltinDataAllocator*, + void**) { + return kTfLiteOk; +} + // We have this parse function instead of directly returning kTfLiteOk from the // switch-case in ParseOpData because this function is used as part of the // selective registration for the OpResolver implementation in micro. diff --git a/tensorflow/lite/core/api/flatbuffer_conversions.h b/tensorflow/lite/core/api/flatbuffer_conversions.h index 26b36df194b..6f25e9f23df 100644 --- a/tensorflow/lite/core/api/flatbuffer_conversions.h +++ b/tensorflow/lite/core/api/flatbuffer_conversions.h @@ -333,6 +333,9 @@ TfLiteStatus ParseRound(const Operator* op, ErrorReporter* error_reporter, TfLiteStatus ParseRsqrt(const Operator* op, ErrorReporter* error_reporter, BuiltinDataAllocator* allocator, void** builtin_data); +TfLiteStatus ParseSelect(const Operator* op, ErrorReporter* error_reporter, + BuiltinDataAllocator* allocator, void** builtin_data); + TfLiteStatus ParseSelectV2(const Operator* op, ErrorReporter* error_reporter, BuiltinDataAllocator* allocator, void** builtin_data); diff --git a/tensorflow/lite/core/c/common.h b/tensorflow/lite/core/c/common.h index 50b89e85ca4..a3b0dbd7492 100644 --- a/tensorflow/lite/core/c/common.h +++ b/tensorflow/lite/core/c/common.h @@ -1352,7 +1352,15 @@ typedef enum TfLiteDelegateFlags { /// operator information using `Profiler::EventType::OPERATOR_INVOKE_EVENT` /// and the results will appear in the operator-wise Profiling section and not /// in the Delegate internal section. - kTfLiteDelegateFlagsPerOperatorProfiling = 4 + kTfLiteDelegateFlagsPerOperatorProfiling = 4, + + // This flag can be used by callers to hint that the delegate is likely to + // delegate the entire graph to a single delegate so certain allocations can + // be skipped. + // This is an ADVANCED feature and should only be used if the caller has + // prior knowledge that the delegate will fully delegate all subgraphs + // to a single delegate. + kTfLiteDelegateFlagsHintFullyDelegatedToSingleDelegate = 8, } TfLiteDelegateFlags; /// WARNING: This is an experimental interface that is subject to change.