aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/allocation.h
diff options
context:
space:
mode:
authorGravatar Jared Duke <jdduke@google.com>2018-08-29 08:58:27 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-29 09:07:49 -0700
commit97fb9a9c7c72c405a790eea698a91654d5184fed (patch)
treede458ca70534a20174fc0fc93465da416e0f9d20 /tensorflow/contrib/lite/allocation.h
parent0f443619fb13fcd5c34cb7d8c867b64339afdcfc (diff)
Disable rtti for (most) TFLite targets on Android
PiperOrigin-RevId: 210729533
Diffstat (limited to 'tensorflow/contrib/lite/allocation.h')
-rw-r--r--tensorflow/contrib/lite/allocation.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/allocation.h b/tensorflow/contrib/lite/allocation.h
index 121f3d2646..ca935f6fd4 100644
--- a/tensorflow/contrib/lite/allocation.h
+++ b/tensorflow/contrib/lite/allocation.h
@@ -30,6 +30,13 @@ namespace tflite {
// A memory allocation handle. This could be a mmap or shared memory.
class Allocation {
public:
+ enum class Type {
+ kMMAP, // Backed by mmap.
+ kFileCopy, // Backed by memory copied from a file.
+ kMemory, // Backed by an existing memory buffer.
+ kNNAPI, // Backed by mmap and an associated NNAPI buffer.
+ };
+
Allocation(ErrorReporter* error_reporter) : error_reporter_(error_reporter) {}
virtual ~Allocation() {}
@@ -39,6 +46,8 @@ class Allocation {
virtual size_t bytes() const = 0;
// Whether the allocation is valid
virtual bool valid() const = 0;
+ // The type of the allocation
+ virtual Type type() const = 0;
protected:
ErrorReporter* error_reporter_;
@@ -51,6 +60,7 @@ class MMAPAllocation : public Allocation {
const void* base() const override;
size_t bytes() const override;
bool valid() const override;
+ Type type() const override;
static bool IsSupported();
@@ -68,6 +78,7 @@ class FileCopyAllocation : public Allocation {
const void* base() const override;
size_t bytes() const override;
bool valid() const override;
+ Type type() const override;
private:
// Data required for mmap.
@@ -86,6 +97,7 @@ class MemoryAllocation : public Allocation {
const void* base() const override;
size_t bytes() const override;
bool valid() const override;
+ Type type() const override;
private:
const void* buffer_;