Expose read-only versions of input tensors in tflite.
authorA. Unique TensorFlower <gardener@tensorflow.org>
Fri, 18 May 2018 19:21:44 +0000 (12:21 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Fri, 18 May 2018 19:24:45 +0000 (12:24 -0700)
PiperOrigin-RevId: 197183345

tensorflow/contrib/lite/interpreter.h

index 0450e86..7315d83 100644 (file)
@@ -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 <class T>
   T* typed_input_tensor(int index) {
     return typed_tensor<T>(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 <class T>
+  const T* typed_input_tensor(int index) const {
+    return typed_tensor<T>(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 <class T>