From e0bad4c6832d6eefbaacf040e9fa26601674382e Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Fri, 18 May 2018 12:21:44 -0700 Subject: [PATCH] Expose read-only versions of input tensors in tflite. PiperOrigin-RevId: 197183345 --- tensorflow/contrib/lite/interpreter.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tensorflow/contrib/lite/interpreter.h b/tensorflow/contrib/lite/interpreter.h index 0450e86..7315d83 100644 --- a/tensorflow/contrib/lite/interpreter.h +++ b/tensorflow/contrib/lite/interpreter.h @@ -249,13 +249,20 @@ class Interpreter { return nullptr; } - // Return a pointer into the data of a given input tensor. The given index - // must be between 0 and inputs().size(). + // Return a mutable pointer into the data of a given input tensor. The given + // index must be between 0 and inputs().size(). template T* typed_input_tensor(int index) { return typed_tensor(inputs_[index]); } + // Return an immutable pointer into the data of a given input tensor. The + // given index must be between 0 and inputs().size(). + template + const T* typed_input_tensor(int index) const { + return typed_tensor(inputs_[index]); + } + // Return a mutable pointer into the data of a given output tensor. The given // index must be between 0 and outputs().size(). template -- 2.7.4