ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci_interpreter::StaticMemoryManager Class Reference

#include <StaticMemoryManager.h>

Collaboration diagram for luci_interpreter::StaticMemoryManager:

Public Member Functions

 StaticMemoryManager ()=delete
 
 StaticMemoryManager (uint8_t *buffer_ptr)
 
void allocate_memory (luci_interpreter::Tensor &tensor) final
 
void release_memory (luci_interpreter::Tensor &tensor) final
 
- Public Member Functions inherited from luci_interpreter::IMemoryManager
virtual ~IMemoryManager ()=default
 

Detailed Description

Definition at line 26 of file StaticMemoryManager.h.

Constructor & Destructor Documentation

◆ StaticMemoryManager() [1/2]

luci_interpreter::StaticMemoryManager::StaticMemoryManager ( )
delete

◆ StaticMemoryManager() [2/2]

luci_interpreter::StaticMemoryManager::StaticMemoryManager ( uint8_t *  buffer_ptr)
inlineexplicit

Definition at line 31 of file StaticMemoryManager.h.

31 : _buffer_ptr(buffer_ptr)
32 { /* Do nothing */
33 }

Member Function Documentation

◆ allocate_memory()

void luci_interpreter::StaticMemoryManager::allocate_memory ( luci_interpreter::Tensor tensor)
finalvirtual

Implements luci_interpreter::IMemoryManager.

Definition at line 22 of file StaticMemoryManager.cpp.

23{
24 if (!tensor.is_allocatable())
25 {
26 return;
27 }
28 int32_t offset = tensor.get_offset();
29 assert(offset >= 0);
30 auto tensor_ptr = _buffer_ptr + offset;
31 tensor.set_data_buffer(tensor_ptr);
32}
__global uchar * offset(const Image *img, int x, int y)
Definition helpers.h:540

References offset().

◆ release_memory()

void luci_interpreter::StaticMemoryManager::release_memory ( luci_interpreter::Tensor tensor)
finalvirtual

Implements luci_interpreter::IMemoryManager.

Definition at line 34 of file StaticMemoryManager.cpp.

35{
36 tensor.set_data_buffer(nullptr);
37}

The documentation for this class was generated from the following files: