aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/interpreter.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-09-11 15:36:21 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-11 15:45:27 -0700
commit6305a6d83552ba6a472cd72398b60d9241467f1f (patch)
treed02fb52415cefa562db46816c230e7522a702c90 /tensorflow/contrib/lite/interpreter.h
parentb1f29d4c618d6bfa85130917848cd7eb89bf0f3b (diff)
Add an experimental API to allow half precision for FP32 calculation.
PiperOrigin-RevId: 212535448
Diffstat (limited to 'tensorflow/contrib/lite/interpreter.h')
-rw-r--r--tensorflow/contrib/lite/interpreter.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/interpreter.h b/tensorflow/contrib/lite/interpreter.h
index f0cd178c19..aa2bc4def6 100644
--- a/tensorflow/contrib/lite/interpreter.h
+++ b/tensorflow/contrib/lite/interpreter.h
@@ -336,6 +336,19 @@ class Interpreter {
// Set the number of threads available to the interpreter.
void SetNumThreads(int num_threads);
+ // Allow float16 precision for FP32 calculation when possible.
+ // default: not allow.
+ // WARNING: This is an experimental API and subject to change.
+ void SetAllowFp16PrecisionForFp32(bool allow) {
+ context_.allow_fp32_relax_to_fp16 = allow;
+ }
+
+ // Get the half precision flag.
+ // WARNING: This is an experimental API and subject to change.
+ bool GetAllowFp16PrecisionForFp32() const {
+ return context_.allow_fp32_relax_to_fp16;
+ }
+
// Allow a delegate to look at the graph and modify the graph to handle
// parts of the graph themselves. After this is called, the graph may
// contain new nodes that replace 1 more nodes.