8000 Add a warning to `tflite::Interpreter` functions that return pointers… · IBMZ-Linux-OSS-Python/tensorflow@034dd63 · GitHub
[go: up one dir, main page]

Skip to content

Commit 034dd63

Browse files
qukhantensorflower-gardener
authored andcommitted
Add a warning to tflite::Interpreter functions that return pointers that may be invalidated.
PiperOrigin-RevId: 766305859
1 parent de9b872 commit 034dd63

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tensorflow/lite/core/interpreter.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,23 @@ class Interpreter {
298298
return primary_subgraph().tensor(tensor_index);
299299
}
300300

301-
/// Returns a pointer to an operation and registration data structure if in
302-
/// bounds from the primary subgraph(subgraph_[0]).
301+
// Returns a pointer to an operation and registration data structure if in
302+
// bounds from the primary subgraph(subgraph_[0]).
303+
//
304+
// Warning: No guarantee is given about address stability. Operations
305+
// (including but not limited to: `Invoke`, `ModifyGraphWithDelegate`) may
306+
// invalidate the pointer returned by this function.
303307
const std::pair<TfLiteNode, TfLiteRegistration>* node_and_registration(
304308
int node_index) const {
305309
return primary_subgraph().node_and_registration(node_index);
306310
}
307311

308-
/// Returns a pointer to an operation and registration data structure if in
309-
/// bounds.
312+
// Returns a pointer to an operation and registration data structure if in
313+
// bounds.
314+
//
315+
// Warning: No guarantee is given about address stability. Operations
316+
// (including but not limited to: `Invoke`, `ModifyGraphWithDelegate`) may
317+
// invalidate the pointer returned by this function.
310318
const std::pair<TfLiteNode, TfLiteRegistration>* node_and_registration(
311319
int subgraph_index, int node_index) const {
312320
return subgraph(subgraph_index)->node_and_registration(node_index);

0 commit comments

Comments
 (0)
0