tensorflow/lite/g3doc/api_docs/cc/class/tflite/m-m-a-p-allocation.html
#include <allocation.h>
Note that not all platforms support MMAP-based allocation.
Use IsSupported() to check.
Inherits from: tflite::Allocation
|
|
| --- |
| MMAPAllocation(const char *filename, ErrorReporter *error_reporter)
Loads and maps the provided file to a memory region.
|
| MMAPAllocation(int fd, ErrorReporter *error_reporter)
Maps the provided file descriptor to a memory region.
|
| MMAPAllocation(int fd, size_t offset, size_t length, ErrorReporter *error_reporter)
Maps the provided file descriptor, with the given offset and length (both in bytes), to a memory region.
|
| ~MMAPAllocation()
|
|
|
| --- |
| buffer_size_bytes_ = 0 |
size_t
|
| mmap_fd_ = -1 |
int
|
| mmapped_buffer_ |
const void *
|
| offset_in_buffer_ = 0 |
size_t
|
| offset_of_buffer_in_file_ = 0 |
size_t
|
|
|
| --- |
| base() const override |
virtual const void *
Base pointer of this allocation.
|
| bytes() const override |
virtual size_t
Size in bytes of the allocation.
|
| fd() const |
int
|
| mmapped_buffer() const |
const void *
|
| mmapped_buffer_offset_in_file() const |
size_t
|
| mmapped_buffer_size() const |
size_t
|
| valid() const override |
virtual bool
Whether the allocation is valid. |
|
|
| --- |
| IsSupported() |
bool
|
size_t buffer_size_bytes_ = 0
int mmap_fd_ = -1
const void * mmapped_buffer_
size_t offset_in_buffer_ = 0
size_t offset_of_buffer_in_file_ = 0
MMAPAllocation(
const char *filename,[ErrorReporter](/lite/api_docs/cc/class/tflite/error-reporter.html#classtflite_1_1_error_reporter)*error_reporter
)
Loads and maps the provided file to a memory region.
MMAPAllocation(
int fd,[ErrorReporter](/lite/api_docs/cc/class/tflite/error-reporter.html#classtflite_1_1_error_reporter)*error_reporter
)
Maps the provided file descriptor to a memory region.
Note: The provided file descriptor will be dup'ed for usage; the caller retains ownership of the provided descriptor and should close accordingly.
MMAPAllocation(
int fd,
size_t offset,
size_t length,[ErrorReporter](/lite/api_docs/cc/class/tflite/error-reporter.html#classtflite_1_1_error_reporter)*error_reporter
)
Maps the provided file descriptor, with the given offset and length (both in bytes), to a memory region.
Note: The provided file descriptor will be dup'ed for usage; the caller retains ownership of the provided descriptor and should close accordingly.
virtual const void * base() const override
Base pointer of this allocation.
virtual size_t bytes() const override
Size in bytes of the allocation.
int fd() const
const void * mmapped_buffer() const
size_t mmapped_buffer_offset_in_file() const
size_t mmapped_buffer_size() const
virtual bool valid() const override
Whether the allocation is valid.
~MMAPAllocation() override
bool IsSupported()