Skip to content

Commit 3f0bb1a

Browse files
authored
Sync from tflite-micro. (tensorflow#171)
1 parent bf907ff commit 3f0bb1a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/tensorflow/lite/core/c/common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ void* TfLiteOpaqueDelegateGetData(const TfLiteOpaqueDelegate* delegate) {
346346
const auto* tflite_delegate =
347347
reinterpret_cast<const TfLiteDelegate*>(delegate);
348348

349-
if (!tflite_delegate->opaque_delegate_builder) return nullptr;
349+
if (!tflite_delegate->opaque_delegate_builder) return tflite_delegate->data_;
350350

351351
return tflite_delegate->opaque_delegate_builder->data;
352352
}

src/tensorflow/lite/core/c/common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,9 @@ void TfLiteOpaqueDelegateDelete(TfLiteOpaqueDelegate* delegate);
11481148
// - Or in case of any other error.
11491149
// - The 'delegate' has been constructed via a 'TfLiteOpaqueDelegateBuilder',
11501150
// but the 'data' field of the 'TfLiteOpaqueDelegateBuilder' is null.
1151+
//
1152+
// The data_ field of 'delegate' will be returned if the
1153+
// 'opaque_delegate_builder' field is null.
11511154
void* TfLiteOpaqueDelegateGetData(const TfLiteOpaqueDelegate* delegate);
11521155

11531156
#ifdef __cplusplus

0 commit comments

Comments
 (0)