From: A. Unique TensorFlower Date: Fri, 18 May 2018 19:21:44 +0000 (-0700) Subject: Expose read-only versions of input tensors in tflite. X-Git-Tag: upstream/v1.9.0_rc1~94^2^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e0bad4c6832d6eefbaacf040e9fa26601674382e;p=platform%2Fupstream%2Ftensorflow.git Expose read-only versions of input tensors in tflite. PiperOrigin-RevId: 197183345 --- 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