diff options
author | Andrew Selle <aselle@google.com> | 2018-07-13 10:59:05 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-07-13 11:04:28 -0700 |
commit | b5b5cc0e248b6fbd5025765f592a43af158a1cb2 (patch) | |
tree | 82deb1f8db93f157e1dbc45662a63313aa5bd717 /tensorflow/contrib/lite/arena_planner.h | |
parent | 2449da260ccd7dc075b890729f7a6cbb08e10882 (diff) |
Make an option that allows making the memory plan not reuse space.
This is called 'allow_intermediates'. In the future we should have
a way for users to enable this functionality from the interpreter API.
Also, preserve_inputs is now better commented.
PiperOrigin-RevId: 204496777
Diffstat (limited to 'tensorflow/contrib/lite/arena_planner.h')
-rw-r--r-- | tensorflow/contrib/lite/arena_planner.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tensorflow/contrib/lite/arena_planner.h b/tensorflow/contrib/lite/arena_planner.h index 1d84950e91..82c866734f 100644 --- a/tensorflow/contrib/lite/arena_planner.h +++ b/tensorflow/contrib/lite/arena_planner.h @@ -47,7 +47,7 @@ class ArenaPlanner : public MemoryPlanner { // graph will not share memory with any other tensor, effectively preserving // them until the end of inference. ArenaPlanner(TfLiteContext* context, std::unique_ptr<GraphInfo> graph_info, - bool preserve_inputs); + bool preserve_inputs, bool preserve_intermediates); ~ArenaPlanner() override; ArenaPlanner(const ArenaPlanner&) = delete; ArenaPlanner& operator=(const ArenaPlanner&) = delete; @@ -104,7 +104,14 @@ class ArenaPlanner : public MemoryPlanner { // declared as kTfLiteArenaRwPersistent. SimpleMemoryArena persistent_arena_; + // Ensure that the memory self-allocated for inputs is never reused by the + // allocator. This allows for example, multiple runs without getting + // unpredictable results. bool preserve_inputs_; + + // If true, then no overlapping of memory areas is done, meaning intermediates + // results can be queried after running (modulo running delegates). + bool preserve_intermediates_; }; } // namespace tflite |